diff --git a/extensions/notebook/package.json b/extensions/notebook/package.json index fc9842d853..40c230a40b 100644 --- a/extensions/notebook/package.json +++ b/extensions/notebook/package.json @@ -168,6 +168,23 @@ "when": "false" } ], + "touchBar": [ + { + "command": "notebook.command.runactivecell", + "when": "activeEditor == workbench.editor.notebookEditor", + "group": "1_notebook" + }, + { + "command": "notebook.command.addcode", + "when": "activeEditor == workbench.editor.notebookEditor", + "group": "2_notebook" + }, + { + "command": "notebook.command.addtext", + "when": "activeEditor == workbench.editor.notebookEditor", + "group": "2_notebook" + } + ], "objectExplorer/item/context": [ { "command": "notebook.command.new", diff --git a/src/sql/parts/query/common/query.contribution.ts b/src/sql/parts/query/common/query.contribution.ts index f63e7218ba..2e11230f8e 100644 --- a/src/sql/parts/query/common/query.contribution.ts +++ b/src/sql/parts/query/common/query.contribution.ts @@ -10,11 +10,12 @@ import { EditorDescriptor, IEditorRegistry, Extensions as EditorExtensions } fro import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actions'; import { IConfigurationRegistry, Extensions as ConfigExtensions } from 'vs/platform/configuration/common/configurationRegistry'; -import { SyncActionDescriptor } from 'vs/platform/actions/common/actions'; +import { SyncActionDescriptor, MenuId, MenuRegistry } from 'vs/platform/actions/common/actions'; import { KeyMod, KeyCode, KeyChord } from 'vs/base/common/keyCodes'; import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; -import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; +import { ContextKeyExpr, ContextKeyEqualsExpr } from 'vs/platform/contextkey/common/contextkey'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; +import { isMacintosh } from 'vs/base/common/platform'; import { QueryEditor } from 'sql/parts/query/editor/queryEditor'; import { QueryResultsEditor } from 'sql/parts/query/editor/queryResultsEditor'; @@ -106,6 +107,17 @@ actionRegistry.registerWorkbenchAction( RunQueryKeyboardAction.LABEL ); +// Touch Bar +if (isMacintosh) { + // Only show Run Query if the active editor is a query editor. + MenuRegistry.appendMenuItem(MenuId.TouchBarContext, { + command: { id: RunQueryKeyboardAction.ID, title: RunQueryKeyboardAction.LABEL }, + group: 'query', + when: new ContextKeyEqualsExpr('activeEditor', 'workbench.editor.queryEditor') + }); +} + + actionRegistry.registerWorkbenchAction( new SyncActionDescriptor( RunCurrentQueryKeyboardAction, diff --git a/src/sql/workbench/parts/notebook/notebook.component.html b/src/sql/workbench/parts/notebook/notebook.component.html index be2c51272d..cc94dd6979 100644 --- a/src/sql/workbench/parts/notebook/notebook.component.html +++ b/src/sql/workbench/parts/notebook/notebook.component.html @@ -7,7 +7,7 @@