From 2cda8197c932db9001842bb3659373e1c3477713 Mon Sep 17 00:00:00 2001 From: Remi Schnekenburger Date: Tue, 6 Jun 2023 14:23:48 +0200 Subject: [PATCH] vscode: support editor/title/run predefined entry Closes: #9387 The commit adds the "editor/title/run" contribution point to menus Contributed on behalf of STMicroelectronics Signed-off-by: Remi Schnekenburger --- CHANGELOG.md | 1 + .../src/main/browser/menus/menus-contribution-handler.ts | 3 ++- .../src/main/browser/menus/plugin-menu-command-adapter.ts | 1 + .../src/main/browser/menus/vscode-theia-menu-mappings.ts | 3 +++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8eca987b175b7..b19fb528fd60b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ ## v1.39.0 - 06/29/2023 - [debug] added support for conditional exception breakpoints [#12445](https://github.com/eclipse-theia/theia/pull/12445) +- [vscode] Support "editor/title/run" toolbar commands [#12637](https://github.com/eclipse-theia/theia/pull/12637) - Contributed on behalf of STMicroelectronics [Breaking Changes:](#breaking_changes_1.39.0) diff --git a/packages/plugin-ext/src/main/browser/menus/menus-contribution-handler.ts b/packages/plugin-ext/src/main/browser/menus/menus-contribution-handler.ts index 93cddfac85016..6ae93cfef2f0f 100644 --- a/packages/plugin-ext/src/main/browser/menus/menus-contribution-handler.ts +++ b/packages/plugin-ext/src/main/browser/menus/menus-contribution-handler.ts @@ -26,7 +26,7 @@ import { PluginViewWidget } from '../view/plugin-view-widget'; import { QuickCommandService } from '@theia/core/lib/browser'; import { CodeEditorWidgetUtil, codeToTheiaMappings, ContributionPoint, - PLUGIN_EDITOR_TITLE_MENU, PLUGIN_SCM_TITLE_MENU, PLUGIN_VIEW_TITLE_MENU + PLUGIN_EDITOR_TITLE_MENU, PLUGIN_EDITOR_TITLE_RUN_MENU, PLUGIN_SCM_TITLE_MENU, PLUGIN_VIEW_TITLE_MENU } from './vscode-theia-menu-mappings'; import { PluginMenuCommandAdapter, ReferenceCountingSet } from './plugin-menu-command-adapter'; import { ContextKeyExpr } from '@theia/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey'; @@ -56,6 +56,7 @@ export class MenusContributionPointHandler { this.initialized = true; this.commandAdapterRegistry.registerAdapter(this.commandAdapter); this.tabBarToolbar.registerMenuDelegate(PLUGIN_EDITOR_TITLE_MENU, widget => this.codeEditorWidgetUtil.is(widget)); + this.tabBarToolbar.registerMenuDelegate(PLUGIN_EDITOR_TITLE_RUN_MENU, widget => this.codeEditorWidgetUtil.is(widget)); this.tabBarToolbar.registerMenuDelegate(PLUGIN_SCM_TITLE_MENU, widget => widget instanceof ScmWidget); this.tabBarToolbar.registerMenuDelegate(PLUGIN_VIEW_TITLE_MENU, widget => widget instanceof PluginViewWidget); this.tabBarToolbar.registerItem({ id: 'plugin-menu-contribution-title-contribution', command: '_never_', onDidChange: this.onDidChangeTitleContributionEmitter.event }); diff --git a/packages/plugin-ext/src/main/browser/menus/plugin-menu-command-adapter.ts b/packages/plugin-ext/src/main/browser/menus/plugin-menu-command-adapter.ts index 24494f98d7022..f0cfaba0a22ff 100644 --- a/packages/plugin-ext/src/main/browser/menus/plugin-menu-command-adapter.ts +++ b/packages/plugin-ext/src/main/browser/menus/plugin-menu-command-adapter.ts @@ -94,6 +94,7 @@ export class PluginMenuCommandAdapter implements MenuCommandAdapter { ['editor/context', selectedResource], ['editor/title', widgetURI], ['editor/title/context', selectedResource], + ['editor/title/run', widgetURI], ['explorer/context', selectedResource], ['scm/resourceFolder/context', toScmArgs], ['scm/resourceGroup/context', toScmArgs], diff --git a/packages/plugin-ext/src/main/browser/menus/vscode-theia-menu-mappings.ts b/packages/plugin-ext/src/main/browser/menus/vscode-theia-menu-mappings.ts index f8a4b4560a022..b00d2fed0c273 100644 --- a/packages/plugin-ext/src/main/browser/menus/vscode-theia-menu-mappings.ts +++ b/packages/plugin-ext/src/main/browser/menus/vscode-theia-menu-mappings.ts @@ -32,6 +32,7 @@ import { VIEW_ITEM_CONTEXT_MENU } from '../view/tree-view-widget'; import { WebviewWidget } from '../webview/webview'; export const PLUGIN_EDITOR_TITLE_MENU = ['plugin_editor/title']; +export const PLUGIN_EDITOR_TITLE_RUN_MENU = ['plugin_editor/title/run']; export const PLUGIN_SCM_TITLE_MENU = ['plugin_scm/title']; export const PLUGIN_VIEW_TITLE_MENU = ['plugin_view/title']; @@ -45,6 +46,7 @@ export const implementedVSCodeContributionPoints = [ 'editor/context', 'editor/title', 'editor/title/context', + 'editor/title/run', 'explorer/context', 'scm/resourceFolder/context', 'scm/resourceGroup/context', @@ -68,6 +70,7 @@ export const codeToTheiaMappings = new Map([ ['editor/context', [EDITOR_CONTEXT_MENU]], ['editor/title', [PLUGIN_EDITOR_TITLE_MENU]], ['editor/title/context', [SHELL_TABBAR_CONTEXT_MENU]], + ['editor/title/run', [PLUGIN_EDITOR_TITLE_RUN_MENU]], ['explorer/context', [NAVIGATOR_CONTEXT_MENU]], ['scm/resourceFolder/context', [ScmTreeWidget.RESOURCE_FOLDER_CONTEXT_MENU]], ['scm/resourceGroup/context', [ScmTreeWidget.RESOURCE_GROUP_CONTEXT_MENU]],