3
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
4
*--------------------------------------------------------------------------------------------*/
5
5
6
- import { isStandalone } from 'vs/base/browser/browser' ;
7
6
import { alert } from 'vs/base/browser/ui/aria/aria' ;
8
7
import { createCancelablePromise , raceCancellation } from 'vs/base/common/async' ;
9
8
import { CancellationToken } from 'vs/base/common/cancellation' ;
10
9
import { KeyChord , KeyCode , KeyMod } from 'vs/base/common/keyCodes' ;
11
- import { isWeb } from 'vs/base/common/platform' ;
12
10
import { assertType } from 'vs/base/common/types' ;
13
11
import { URI } from 'vs/base/common/uri' ;
14
12
import { CodeEditorStateFlag , EditorStateCancellationTokenSource } from 'vs/editor/contrib/editorState/browser/editorState' ;
@@ -41,6 +39,7 @@ import { getDeclarationsAtPosition, getDefinitionsAtPosition, getImplementations
41
39
import { IWordAtPosition } from 'vs/editor/common/core/wordHelper' ;
42
40
import { ILanguageFeaturesService } from 'vs/editor/common/services/languageFeatures' ;
43
41
import { Iterable } from 'vs/base/common/iterator' ;
42
+ import { IsWebContext } from 'vs/platform/contextkey/common/contextkeys' ;
44
43
45
44
MenuRegistry . appendMenuItem ( MenuId . EditorContext , < ISubmenuItem > {
46
45
submenu : MenuId . EditorContextPeek ,
@@ -272,10 +271,6 @@ export class DefinitionAction extends SymbolNavigationAction {
272
271
}
273
272
}
274
273
275
- const goToDefinitionKb = isWeb && ! isStandalone ( )
276
- ? KeyMod . CtrlCmd | KeyCode . F12
277
- : KeyCode . F12 ;
278
-
279
274
registerAction2 ( class GoToDefinitionAction extends DefinitionAction {
280
275
281
276
static readonly id = 'editor.action.revealDefinition' ;
@@ -295,11 +290,15 @@ registerAction2(class GoToDefinitionAction extends DefinitionAction {
295
290
precondition : ContextKeyExpr . and (
296
291
EditorContextKeys . hasDefinitionProvider ,
297
292
EditorContextKeys . isInWalkThroughSnippet . toNegated ( ) ) ,
298
- keybinding : {
293
+ keybinding : [ {
299
294
when : EditorContextKeys . editorTextFocus ,
300
- primary : goToDefinitionKb ,
295
+ primary : KeyCode . F12 ,
301
296
weight : KeybindingWeight . EditorContrib
302
- } ,
297
+ } , {
298
+ when : ContextKeyExpr . and ( EditorContextKeys . editorTextFocus , IsWebContext ) ,
299
+ primary : KeyMod . CtrlCmd | KeyCode . F12 ,
300
+ weight : KeybindingWeight . EditorContrib
301
+ } ] ,
303
302
menu : [ {
304
303
id : MenuId . EditorContext ,
305
304
group : 'navigation' ,
@@ -333,11 +332,15 @@ registerAction2(class OpenDefinitionToSideAction extends DefinitionAction {
333
332
precondition : ContextKeyExpr . and (
334
333
EditorContextKeys . hasDefinitionProvider ,
335
334
EditorContextKeys . isInWalkThroughSnippet . toNegated ( ) ) ,
336
- keybinding : {
335
+ keybinding : [ {
337
336
when : EditorContextKeys . editorTextFocus ,
338
- primary : KeyChord ( KeyMod . CtrlCmd | KeyCode . KeyK , goToDefinitionKb ) ,
337
+ primary : KeyChord ( KeyMod . CtrlCmd | KeyCode . KeyK , KeyCode . F12 ) ,
339
338
weight : KeybindingWeight . EditorContrib
340
- }
339
+ } , {
340
+ when : ContextKeyExpr . and ( EditorContextKeys . editorTextFocus , IsWebContext ) ,
341
+ primary : KeyChord ( KeyMod . CtrlCmd | KeyCode . KeyK , KeyMod . CtrlCmd | KeyCode . F12 ) ,
342
+ weight : KeybindingWeight . EditorContrib
343
+ } ]
341
344
} ) ;
342
345
CommandsRegistry . registerCommandAlias ( 'editor.action.openDeclarationToTheSide' , OpenDefinitionToSideAction . id ) ;
343
346
}
0 commit comments