diff --git a/src/vs/editor/contrib/gotoSymbol/browser/goToCommands.ts b/src/vs/editor/contrib/gotoSymbol/browser/goToCommands.ts index 6c753076a49..90b30ee96b2 100644 --- a/src/vs/editor/contrib/gotoSymbol/browser/goToCommands.ts +++ b/src/vs/editor/contrib/gotoSymbol/browser/goToCommands.ts @@ -3,12 +3,10 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { isStandalone } from 'vs/base/browser/browser'; import { alert } from 'vs/base/browser/ui/aria/aria'; import { createCancelablePromise, raceCancellation } from 'vs/base/common/async'; import { CancellationToken } from 'vs/base/common/cancellation'; import { KeyChord, KeyCode, KeyMod } from 'vs/base/common/keyCodes'; -import { isWeb } from 'vs/base/common/platform'; import { assertType } from 'vs/base/common/types'; import { URI } from 'vs/base/common/uri'; import { CodeEditorStateFlag, EditorStateCancellationTokenSource } from 'vs/editor/contrib/editorState/browser/editorState'; @@ -41,6 +39,7 @@ import { getDeclarationsAtPosition, getDefinitionsAtPosition, getImplementations import { IWordAtPosition } from 'vs/editor/common/core/wordHelper'; import { ILanguageFeaturesService } from 'vs/editor/common/services/languageFeatures'; import { Iterable } from 'vs/base/common/iterator'; +import { IsWebContext } from 'vs/platform/contextkey/common/contextkeys'; MenuRegistry.appendMenuItem(MenuId.EditorContext, { submenu: MenuId.EditorContextPeek, @@ -272,10 +271,6 @@ export class DefinitionAction extends SymbolNavigationAction { } } -const goToDefinitionKb = isWeb && !isStandalone() - ? KeyMod.CtrlCmd | KeyCode.F12 - : KeyCode.F12; - registerAction2(class GoToDefinitionAction extends DefinitionAction { static readonly id = 'editor.action.revealDefinition'; @@ -295,11 +290,15 @@ registerAction2(class GoToDefinitionAction extends DefinitionAction { precondition: ContextKeyExpr.and( EditorContextKeys.hasDefinitionProvider, EditorContextKeys.isInWalkThroughSnippet.toNegated()), - keybinding: { + keybinding: [{ when: EditorContextKeys.editorTextFocus, - primary: goToDefinitionKb, + primary: KeyCode.F12, weight: KeybindingWeight.EditorContrib - }, + }, { + when: ContextKeyExpr.and(EditorContextKeys.editorTextFocus, IsWebContext), + primary: KeyMod.CtrlCmd | KeyCode.F12, + weight: KeybindingWeight.EditorContrib + }], menu: [{ id: MenuId.EditorContext, group: 'navigation', @@ -333,11 +332,15 @@ registerAction2(class OpenDefinitionToSideAction extends DefinitionAction { precondition: ContextKeyExpr.and( EditorContextKeys.hasDefinitionProvider, EditorContextKeys.isInWalkThroughSnippet.toNegated()), - keybinding: { + keybinding: [{ when: EditorContextKeys.editorTextFocus, - primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KeyK, goToDefinitionKb), + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KeyK, KeyCode.F12), weight: KeybindingWeight.EditorContrib - } + }, { + when: ContextKeyExpr.and(EditorContextKeys.editorTextFocus, IsWebContext), + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KeyK, KeyMod.CtrlCmd | KeyCode.F12), + weight: KeybindingWeight.EditorContrib + }] }); CommandsRegistry.registerCommandAlias('editor.action.openDeclarationToTheSide', OpenDefinitionToSideAction.id); }