slightly better uri for untitled notebooks, https://github.com/microsoft/vscode/issues/121974

This commit is contained in:
Johannes Rieken
2021-05-19 18:43:56 +02:00
parent 52c8fced38
commit 9716c27e06
3 changed files with 4 additions and 4 deletions

View File

@@ -119,12 +119,12 @@ export class MainThreadNotebookDocuments implements MainThreadNotebookDocumentsS
};
}
async $tryCreateNotebook(options: { viewType?: string, content?: NotebookDataDto }): Promise<UriComponents> {
async $tryCreateNotebook(options: { viewType: string, content?: NotebookDataDto }): Promise<UriComponents> {
// find a free URI for the untitled case
let uri: URI;
for (let counter = 1; ; counter++) {
let candidate = URI.from({ scheme: Schemas.untitled, path: `Untitled-Notebook-${counter}` });
let candidate = URI.from({ scheme: Schemas.untitled, path: `Untitled-${counter}`, query: options.viewType });
if (!this._notebookService.getNotebookTextModel(candidate)) {
uri = candidate;
break;