Skip to content

Commit

Permalink
Align terminal command ids with VS Code. Fixes #12084 (#12134)
Browse files Browse the repository at this point in the history
* Align terminal command ids with VS Code. Fixes #12084

Contributed on behalf of STMicroelectronics

Signed-off-by: Thomas Mäder <[email protected]>
  • Loading branch information
tsmaeder authored Feb 8, 2023
1 parent 6959b6a commit ec6bf6c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 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
17 changes: 16 additions & 1 deletion packages/plugin-ext/src/plugin/known-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
// *****************************************************************************

import { Range as R, Position as P, Location as L } from '@theia/core/shared/vscode-languageserver-protocol';
import * as theia from '@theia/plugin';
import { Range as R, Position as P, Location as L } from '@theia/core/shared/vscode-languageserver-protocol';
import { URI as TheiaURI } from '@theia/core/lib/common/uri';
import { cloneAndChange } from '../common/objects';
import { Position, Range, Location, CallHierarchyItem, TypeHierarchyItem, URI, TextDocumentShowOptions } from './types-impl';
import {
Expand Down Expand Up @@ -63,6 +64,9 @@ export namespace KnownCommands {
}
};

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const identity = (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 +306,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', identity];
mappings['workbench.action.terminal.newWithProfile'] = ['terminal:new:profile', identity];
mappings['workbench.action.terminal.selectDefaultShell'] = ['terminal:profile:default', identity];
mappings['workbench.action.terminal.newInActiveWorkspace'] = ['terminal:new:active:workspace', identity];
mappings['workbench.action.terminal.clear'] = ['terminal:clear', identity];
mappings['openInTerminal'] = ['terminal:context', createConversionFunction((uri: URI) => new TheiaURI(uri))];
mappings['workbench.action.terminal.split'] = ['terminal:split', identity];
mappings['workbench.action.terminal.focusFind'] = ['terminal:find', identity];
mappings['workbench.action.terminal.hideFind'] = ['terminal:find:cancel', identity];

// 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 ec6bf6c

Please sign in to comment.