Skip to content

Commit

Permalink
Align terminal command ids with VS Code. Fixes #12084
Browse files Browse the repository at this point in the history
Contributed on behalf of STMicroelectronics

Signed-off-by: Thomas Mäder <[email protected]>
  • Loading branch information
tsmaeder committed Jan 31, 2023
1 parent d850c16 commit a85241b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/plugin-ext/src/plugin/dialogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export class DialogsExtImpl {
title: options.title,
openLabel: options.openLabel,
defaultUri: options.defaultUri ? options.defaultUri.path : undefined,
canSelectFiles: options.canSelectFiles ? options.canSelectFiles : true,
canSelectFolders: options.canSelectFolders ? options.canSelectFolders : false,
canSelectFiles: typeof options.canSelectFiles === 'boolean' ? options.canSelectFiles : true,
canSelectFolders: typeof options.canSelectFolders === 'boolean' ? options.canSelectFolders : false,
canSelectMany: options.canSelectMany,
filters: options.filters
} as OpenDialogOptionsMain;
Expand Down
16 changes: 16 additions & 0 deletions packages/plugin-ext/src/plugin/known-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import {
isModelCallHierarchyOutgoingCall, toCallHierarchyOutgoingCall, fromTextDocumentShowOptions
} from './type-converters';

import { URI as TheiaURI } from '@theia/core/lib/common/uri';

// Here is a mapping of VSCode commands to monaco commands with their conversions
export namespace KnownCommands {

Expand Down Expand Up @@ -63,6 +65,9 @@ export namespace KnownCommands {
}
};

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const ID = (args: any[]) => args;

mappings['editor.action.select.all'] = ['editor.action.select.all', CONVERT_VSCODE_TO_MONACO];
mappings['editor.action.toggleHighContrast'] = ['editor.action.toggleHighContrast', CONVERT_VSCODE_TO_MONACO];
mappings['editor.action.moveCarretLeftAction'] = ['editor.action.moveCarretLeftAction', CONVERT_VSCODE_TO_MONACO];
Expand Down Expand Up @@ -302,6 +307,17 @@ export namespace KnownCommands {
mappings['vscode.open'] = ['vscode.open', CONVERT_VSCODE_TO_MONACO];
mappings['vscode.diff'] = ['vscode.diff', CONVERT_VSCODE_TO_MONACO];

// terminal commands
mappings['workbench.action.terminal.new'] = ['terminal:new', ID];
mappings['workbench.action.terminal.newWithProfile'] = ['terminal:new:profile', ID];
mappings['workbench.action.terminal.selectDefaultShell'] = ['terminal:profile:default', ID];
mappings['workbench.action.terminal.newInActiveWorkspace'] = ['terminal:new:active:workspace', ID];
mappings['workbench.action.terminal.clear'] = ['terminal:clear', ID];
mappings['openInTerminal'] = ['terminal:context', createConversionFunction((uri: URI) => new TheiaURI(uri))];
mappings['workbench.action.terminal.split'] = ['terminal:split', ID];
mappings['workbench.action.terminal.focusFind'] = ['terminal:find', ID];
mappings['workbench.action.terminal.hideFind'] = ['terminal:find:cancel', ID];

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function map<T>(id: string, args: any[] | undefined, toDo: (mappedId: string, mappedArgs: any[] | undefined, mappedResult: ConversionFunction | undefined) => T): T {
if (mappings[id]) {
Expand Down

0 comments on commit a85241b

Please sign in to comment.