From 64e95edc96c6f8cbd9380d7fe1873e752e41a175 Mon Sep 17 00:00:00 2001 From: Maddy <12754347+MaddyDev@users.noreply.github.com> Date: Tue, 29 Oct 2019 11:51:05 -0700 Subject: [PATCH] added openLocalizedook action that opens up the link to localized books. (#8025) * initial commit * addressed the tslint floating promise errors * updated the command name with PM's feedback --- extensions/notebook/package.json | 5 ++++ extensions/notebook/package.nls.json | 3 ++- extensions/notebook/src/extension.ts | 34 ++++++++++++++++------------ 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/extensions/notebook/package.json b/extensions/notebook/package.json index ebec353506..0ba9eb303a 100644 --- a/extensions/notebook/package.json +++ b/extensions/notebook/package.json @@ -140,6 +140,11 @@ "title": "%title.SQL19PreviewBook%", "category": "%books-preview-category%" }, + { + "command": "books.command.openLocalizedBooks", + "title": "%title.PreviewLocalizedBook%", + "category": "%books-preview-category%" + }, { "command": "notebook.command.saveBook", "title": "%title.saveJupyterBook%", diff --git a/extensions/notebook/package.nls.json b/extensions/notebook/package.nls.json index 2fc2391f2b..2910e02311 100644 --- a/extensions/notebook/package.nls.json +++ b/extensions/notebook/package.nls.json @@ -32,5 +32,6 @@ "title.saveJupyterBook": "Save Book", "title.searchJupyterBook": "Search Book", "title.SavedBooks": "Saved Books", - "title.UnsavedBooks": "Unsaved Books" + "title.UnsavedBooks": "Unsaved Books", + "title.PreviewLocalizedBook": "Get localized SQL Server 2019 guide" } diff --git a/extensions/notebook/src/extension.ts b/extensions/notebook/src/extension.ts index 15021eb9ab..bdbfba62a1 100644 --- a/extensions/notebook/src/extension.ts +++ b/extensions/notebook/src/extension.ts @@ -44,17 +44,17 @@ export async function activate(extensionContext: vscode.ExtensionContext): Promi } newNotebook(connectionProfile); })); - extensionContext.subscriptions.push(vscode.commands.registerCommand('notebook.command.open', () => { - openNotebook(); + extensionContext.subscriptions.push(vscode.commands.registerCommand('notebook.command.open', async () => { + await openNotebook(); })); - extensionContext.subscriptions.push(vscode.commands.registerCommand('notebook.command.runactivecell', () => { - runActiveCell(); + extensionContext.subscriptions.push(vscode.commands.registerCommand('notebook.command.runactivecell', async () => { + await runActiveCell(); })); - extensionContext.subscriptions.push(vscode.commands.registerCommand('notebook.command.runallcells', () => { - runAllCells(); + extensionContext.subscriptions.push(vscode.commands.registerCommand('notebook.command.runallcells', async () => { + await runAllCells(); })); - extensionContext.subscriptions.push(vscode.commands.registerCommand('notebook.command.clearactivecellresult', () => { - clearActiveCellOutput(); + extensionContext.subscriptions.push(vscode.commands.registerCommand('notebook.command.clearactivecellresult', async () => { + await clearActiveCellOutput(); })); extensionContext.subscriptions.push(vscode.commands.registerCommand('notebook.command.addcell', async () => { let cellType: CellType; @@ -77,20 +77,24 @@ export async function activate(extensionContext: vscode.ExtensionContext): Promi return; } if (cellType) { - addCell(cellType); + await addCell(cellType); } })); - extensionContext.subscriptions.push(vscode.commands.registerCommand('notebook.command.addcode', () => { - addCell('code'); + extensionContext.subscriptions.push(vscode.commands.registerCommand('notebook.command.addcode', async () => { + await addCell('code'); })); - extensionContext.subscriptions.push(vscode.commands.registerCommand('notebook.command.addtext', () => { - addCell('markdown'); + extensionContext.subscriptions.push(vscode.commands.registerCommand('notebook.command.addtext', async () => { + await addCell('markdown'); })); - extensionContext.subscriptions.push(vscode.commands.registerCommand('notebook.command.analyzeNotebook', (explorerContext: azdata.ObjectExplorerContext) => { - analyzeNotebook(explorerContext); + extensionContext.subscriptions.push(vscode.commands.registerCommand('notebook.command.analyzeNotebook', async (explorerContext: azdata.ObjectExplorerContext) => { + await analyzeNotebook(explorerContext); })); extensionContext.subscriptions.push(vscode.window.registerUriHandler(new NotebookUriHandler())); + extensionContext.subscriptions.push(vscode.commands.registerCommand('books.command.openLocalizedBooks', async () => { + const urlToOpen: string = 'https://aka.ms/localized-BDC-book'; + await vscode.commands.executeCommand('vscode.open', vscode.Uri.parse(urlToOpen)); + })); let appContext = new AppContext(extensionContext, new ApiWrapper()); controller = new JupyterController(appContext);