diff --git a/packages/plugin-ext-vscode/src/browser/plugin-vscode-commands-contribution.ts b/packages/plugin-ext-vscode/src/browser/plugin-vscode-commands-contribution.ts index ba9790c4f051a..6972ffbf60193 100755 --- a/packages/plugin-ext-vscode/src/browser/plugin-vscode-commands-contribution.ts +++ b/packages/plugin-ext-vscode/src/browser/plugin-vscode-commands-contribution.ts @@ -80,6 +80,8 @@ import * as monaco from '@theia/monaco-editor-core'; import { VSCodeExtensionUri } from '../common/plugin-vscode-uri'; import { CodeEditorWidgetUtil } from '@theia/plugin-ext/lib/main/browser/menus/vscode-theia-menu-mappings'; import { OutlineViewContribution } from '@theia/outline-view/lib/browser/outline-view-contribution'; +import { Range } from '@theia/plugin'; +import { MonacoLanguages } from '@theia/monaco/lib/browser/monaco-languages'; export namespace VscodeCommands { @@ -189,6 +191,8 @@ export class PluginVscodeCommandsContribution implements CommandContribution { protected readonly messageService: MessageService; @inject(OutlineViewContribution) protected outlineViewContribution: OutlineViewContribution; + @inject(MonacoLanguages) + protected monacoLanguages: MonacoLanguages; private async openWith(commandId: string, resource: URI, columnOrOptions?: ViewColumn | TextDocumentShowOptions, openerId?: string): Promise { if (!resource) { @@ -655,6 +659,38 @@ export class PluginVscodeCommandsContribution implements CommandContribution { commands.executeCommand('_executeFormatOnTypeProvider', monaco.Uri.from(resource), position, ch, options)) } ); + commands.registerCommand( + { + id: 'vscode.executeFoldingRangeProvider' + }, + { + execute: ((resource: URI, position: Position) => + commands.executeCommand('_executeFoldingRangeProvider', monaco.Uri.from(resource), position)) + } + ); + commands.registerCommand( + { + id: 'vscode.executeCodeActionProvider' + }, + { + execute: ((resource: URI, range: Range, kind?: string, itemResolveCount?: number) => + commands.executeCommand('_executeCodeActionProvider', monaco.Uri.from(resource), range, kind, itemResolveCount)) + } + ); + commands.registerCommand( + { + id: 'vscode.executeWorkspaceSymbolProvider' + }, + { + execute: async (queryString: string) => + (await Promise.all( + this.monacoLanguages.workspaceSymbolProviders + .map(async provider => provider.provideWorkspaceSymbols({ query: queryString }, new CancellationTokenSource().token)))) + .flatMap(symbols => symbols) + .filter(symbols => !!symbols) + } + ); + commands.registerCommand( { id: 'vscode.prepareCallHierarchy' diff --git a/packages/plugin-ext/src/plugin/known-commands.ts b/packages/plugin-ext/src/plugin/known-commands.ts index e8bf476056d14..7b63db385f364 100755 --- a/packages/plugin-ext/src/plugin/known-commands.ts +++ b/packages/plugin-ext/src/plugin/known-commands.ts @@ -297,6 +297,7 @@ export namespace KnownCommands { mappings['vscode.executeFormatDocumentProvider'] = ['vscode.executeFormatDocumentProvider', CONVERT_VSCODE_TO_MONACO, CONVERT_MONACO_TO_VSCODE]; mappings['vscode.executeFormatRangeProvider'] = ['vscode.executeFormatRangeProvider', CONVERT_VSCODE_TO_MONACO, CONVERT_MONACO_TO_VSCODE]; mappings['vscode.executeFormatOnTypeProvider'] = ['vscode.executeFormatOnTypeProvider', CONVERT_VSCODE_TO_MONACO, CONVERT_MONACO_TO_VSCODE]; + mappings['vscode.executeCodeActionProvider'] = ['vscode.executeCodeActionProvider', CONVERT_VSCODE_TO_MONACO, CONVERT_MONACO_TO_VSCODE]; mappings['vscode.prepareCallHierarchy'] = ['vscode.prepareCallHierarchy', CONVERT_VSCODE_TO_MONACO, CONVERT_MONACO_TO_VSCODE]; mappings['vscode.provideIncomingCalls'] = ['vscode.provideIncomingCalls', CONVERT_VSCODE_TO_MONACO, CONVERT_MONACO_TO_VSCODE]; mappings['vscode.provideOutgoingCalls'] = ['vscode.provideOutgoingCalls', CONVERT_VSCODE_TO_MONACO, CONVERT_MONACO_TO_VSCODE];