Pass connectionid to registered commands from command line (#3861)

* pass connectionid to registered commands from commandline

* remove blank lines

* fix commandline unit test
This commit is contained in:
David Shiflet
2019-01-30 18:18:25 -05:00
committed by GitHub
parent d1fef24723
commit 8a7bbd1795
3 changed files with 12 additions and 4 deletions

View File

@@ -13,10 +13,18 @@ const localize = nls.loadMessageBundle();
let counter = 0;
export function activate(extensionContext: vscode.ExtensionContext) {
extensionContext.subscriptions.push(vscode.commands.registerCommand('notebook.command.new', () => {
extensionContext.subscriptions.push(vscode.commands.registerCommand('notebook.command.new', ( connectionId? : string) => {
let title = `Untitled-${counter++}`;
let untitledUri = vscode.Uri.parse(`untitled:${title}`);
sqlops.nb.showNotebookDocument(untitledUri).then(success => {
let options: sqlops.nb.NotebookShowOptions = connectionId? {
viewColumn : null,
preserveFocus : true,
preview: null,
providerId : null,
connectionId : connectionId,
defaultKernel : null
} : null;
sqlops.nb.showNotebookDocument(untitledUri, options).then(success => {
}, (err: Error) => {
vscode.window.showErrorMessage(err.message);