Fix New Notebook issues (#5958)

* Fix New Notebook issues
- Fix #5338 New Notebook menu item should be next to New Query
- Fix #4936 Add a shortcut to create a notebook in the document well

Created a built-in New Notebook command
that routes to the existing extension-based command.
This avoided a rearchitecture that was more complex that seemed worth it.
Per VSCode patterns, used a _ modifier for the existing command so it's "private"
This commit is contained in:
Kevin Cunnane
2019-06-10 16:38:07 -07:00
committed by GitHub
parent 730ad4b814
commit 14a6bf581c
9 changed files with 72 additions and 18 deletions

View File

@@ -45,7 +45,7 @@
"title": "%notebook.analyzeJupyterNotebook%"
},
{
"command": "notebook.command.new",
"command": "_notebook.command.new",
"title": "%notebook.command.new%",
"icon": {
"dark": "resources/dark/new_notebook_inverse.svg",
@@ -145,7 +145,8 @@
"when": "false"
},
{
"command": "notebook.command.new"
"command": "_notebook.command.new",
"when": "false"
},
{
"command": "notebook.command.open"
@@ -204,11 +205,6 @@
}
],
"objectExplorer/item/context": [
{
"command": "notebook.command.new",
"when": "isQueryProvider && nodeType == Server",
"group": "1root@1"
},
{
"command": "notebook.command.analyzeNotebook",
"when": "nodeType=~/^mssqlCluster/ && nodeLabel=~/[^\\s]+(\\.(csv|tsv|txt))$/ && nodeType == mssqlCluster:file",
@@ -233,10 +229,6 @@
]
},
"keybindings": [
{
"command": "notebook.command.new",
"key": "Ctrl+Shift+N"
},
{
"command": "notebook.command.runactivecell",
"key": "F5",

View File

@@ -25,7 +25,7 @@ let controller: JupyterController;
type ChooseCellType = { label: string, id: CellType };
export async function activate(extensionContext: vscode.ExtensionContext): Promise<IExtensionApi> {
extensionContext.subscriptions.push(vscode.commands.registerCommand('notebook.command.new', (context?: azdata.ConnectedContext) => {
extensionContext.subscriptions.push(vscode.commands.registerCommand('_notebook.command.new', (context?: azdata.ConnectedContext) => {
let connectionProfile: azdata.IConnectionProfile = undefined;
if (context && context.connectionProfile) {
connectionProfile = context.connectionProfile;