Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align terminal command ids with VS Code. Fixes #12084 #12134

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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';
paul-marechal marked this conversation as resolved.
Show resolved Hide resolved

// 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;
tsmaeder marked this conversation as resolved.
Show resolved Hide resolved

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