Update run w/parameters icon and increment parameterized notebook (#15127)

* update icon and increment parameterized notebook
This commit is contained in:
Vasu Bhog
2021-04-14 15:28:27 -07:00
committed by GitHub
parent e7571410e0
commit 3a1885491f
6 changed files with 39 additions and 4 deletions

View File

@@ -224,6 +224,28 @@ export class NotebookService extends Disposable implements INotebookService {
return await this._editorService.openEditor(fileInput, editorOptions, viewColumnToEditorGroup(this._editorGroupService, options.position));
}
/**
* Will iterate the title of the parameterized notebook since the original notebook is still open
* @param originalTitle is the title of the original notebook that we run parameterized action from
* @returns the title of the parameterized notebook
*/
public getUntitledUriPath(originalTitle: string): string {
let title = originalTitle;
let nextVal = 0;
let ext = path.extname(title);
while (this.listNotebookEditors().findIndex(doc => path.basename(doc.notebookParams.notebookUri.fsPath) === title) > -1) {
if (ext) {
// Need it to be `Readme-0.txt` not `Readme.txt-0`
let titleStart = originalTitle.slice(0, originalTitle.length - ext.length);
title = `${titleStart}-${nextVal}${ext}`;
} else {
title = `${originalTitle}-${nextVal}`;
}
nextVal++;
}
return title;
}
private updateSQLRegistrationWithConnectionProviders() {
// Update the SQL extension
let sqlNotebookKernels = this._providerToStandardKernels.get(notebookConstants.SQL);