mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 17:19:48 +01:00
always use F12 for go to def, on web also register Cmd/Ctrl+F12 as fallback (#184585)
fixes https://github.com/microsoft/vscode/issues/183953
This commit is contained in:
@@ -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, <ISubmenuItem>{
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user