From 608c07c451ea50be89aab01fc3f429257157ce50 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Tue, 24 Jul 2018 17:47:23 +0200 Subject: [PATCH] Have kbOpts.weight be mandatory --- .../editor/browser/controller/coreCommands.ts | 2 +- src/vs/editor/browser/editorExtensions.ts | 61 +++++++++++-------- src/vs/editor/browser/widget/diffReview.ts | 7 ++- .../bracketMatching/bracketMatching.ts | 4 +- .../contrib/caretOperations/transpose.ts | 4 +- src/vs/editor/contrib/clipboard/clipboard.ts | 13 ++-- .../contrib/codeAction/codeActionCommands.ts | 10 ++- src/vs/editor/contrib/comment/comment.ts | 13 ++-- .../editor/contrib/contextmenu/contextmenu.ts | 4 +- .../editor/contrib/cursorUndo/cursorUndo.ts | 4 +- src/vs/editor/contrib/find/findController.ts | 21 ++++--- src/vs/editor/contrib/folding/folding.ts | 31 +++++++--- src/vs/editor/contrib/format/formatActions.ts | 7 ++- .../goToDefinition/goToDefinitionCommands.ts | 22 ++++--- src/vs/editor/contrib/gotoError/gotoError.ts | 6 +- src/vs/editor/contrib/hover/hover.ts | 4 +- .../contrib/inPlaceReplace/inPlaceReplace.ts | 7 ++- .../linesOperations/linesOperations.ts | 40 ++++++++---- .../editor/contrib/multicursor/multicursor.ts | 22 ++++--- .../contrib/parameterHints/parameterHints.ts | 3 +- .../referenceSearch/referenceSearch.ts | 3 +- src/vs/editor/contrib/rename/rename.ts | 3 +- .../editor/contrib/smartSelect/smartSelect.ts | 7 ++- .../contrib/suggest/suggestController.ts | 3 +- .../toggleTabFocusMode/toggleTabFocusMode.ts | 4 +- .../wordHighlighter/wordHighlighter.ts | 7 ++- .../contrib/wordOperations/wordOperations.ts | 19 ++++-- .../wordPartOperations/wordPartOperations.ts | 19 ++++-- .../accessibilityHelp/accessibilityHelp.ts | 3 +- .../standalone/browser/quickOpen/gotoLine.ts | 4 +- .../browser/quickOpen/quickCommand.ts | 4 +- .../browser/quickOpen/quickOutline.ts | 4 +- .../electron-browser/accessibility.ts | 3 +- .../electron-browser/toggleWordWrap.ts | 4 +- .../parts/debug/browser/debugEditorActions.ts | 7 ++- .../electron-browser/breakpointWidget.ts | 7 ++- .../parts/debug/electron-browser/repl.ts | 4 +- .../actions/expandAbbreviation.ts | 4 +- .../electron-browser/extensionEditor.ts | 5 +- .../browser/keybindingsEditorContribution.ts | 4 +- .../preferences.contribution.ts | 40 ++++++------ .../electron-browser/dirtydiffDecorator.ts | 8 +-- .../electron-browser/webview.contribution.ts | 15 +++-- 43 files changed, 306 insertions(+), 160 deletions(-) diff --git a/src/vs/editor/browser/controller/coreCommands.ts b/src/vs/editor/browser/controller/coreCommands.ts index b6c64c1cc53..7d864dbe9c4 100644 --- a/src/vs/editor/browser/controller/coreCommands.ts +++ b/src/vs/editor/browser/controller/coreCommands.ts @@ -1620,7 +1620,7 @@ function findFocusedEditor(accessor: ServicesAccessor): ICodeEditor { } function registerCommand(command: Command) { - command.register(CORE_WEIGHT); + command.register(); } /** diff --git a/src/vs/editor/browser/editorExtensions.ts b/src/vs/editor/browser/editorExtensions.ts index 1327d5722fc..dd522f9adac 100644 --- a/src/vs/editor/browser/editorExtensions.ts +++ b/src/vs/editor/browser/editorExtensions.ts @@ -29,7 +29,7 @@ export type IEditorContributionCtor = IConstructorSignature1 this.runCommand(accessor, args), + weight: this._kbOpts.weight, + when: kbWhen, + primary: this._kbOpts.primary, + secondary: this._kbOpts.secondary, + win: this._kbOpts.win, + linux: this._kbOpts.linux, + mac: this._kbOpts.mac, + description: this._description + }; + } return { id: this.id, handler: (accessor, args) => this.runCommand(accessor, args), - weight: weight, - when: kbWhen, - primary: kbOpts.primary, - secondary: kbOpts.secondary, - win: kbOpts.win, - linux: kbOpts.linux, - mac: kbOpts.mac, + weight: undefined, + when: undefined, + primary: 0, + secondary: undefined, + win: undefined, + linux: undefined, + mac: undefined, description: this._description }; } - public register(defaultWeight: number): void { - KeybindingsRegistry.registerCommandAndKeybindingRule(this._toCommandAndKeybindingRule(defaultWeight)); + public register(): void { + KeybindingsRegistry.registerCommandAndKeybindingRule(this._toCommandAndKeybindingRule()); } public abstract runCommand(accessor: ServicesAccessor, args: any): void | TPromise; @@ -193,14 +204,14 @@ export abstract class EditorAction extends EditorCommand { }; } - public register(defaultWeight: number): void { + public register(): void { let menuItem = this._toMenuItem(); if (menuItem) { MenuRegistry.appendMenuItem(MenuId.EditorContext, menuItem); } - super.register(defaultWeight); + super.register(); } public runEditorCommand(accessor: ServicesAccessor, editor: ICodeEditor, args: any): void | TPromise { @@ -316,7 +327,7 @@ class EditorContributionRegistry { } public registerEditorAction(action: EditorAction) { - action.register(KeybindingsRegistry.WEIGHT.editorContrib()); + action.register(); this.editorActions.push(action); } @@ -329,7 +340,7 @@ class EditorContributionRegistry { } public registerEditorCommand(editorCommand: EditorCommand) { - editorCommand.register(KeybindingsRegistry.WEIGHT.editorContrib()); + editorCommand.register(); this.editorCommands[editorCommand.id] = editorCommand; } diff --git a/src/vs/editor/browser/widget/diffReview.ts b/src/vs/editor/browser/widget/diffReview.ts index c06799df4c5..37b7076b07b 100644 --- a/src/vs/editor/browser/widget/diffReview.ts +++ b/src/vs/editor/browser/widget/diffReview.ts @@ -30,6 +30,7 @@ import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { ITextModel, TextModelResolvedOptions } from 'vs/editor/common/model'; import { ViewLineRenderingData } from 'vs/editor/common/viewModel/viewModel'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; const DIFF_LINES_PADDING = 3; @@ -810,7 +811,8 @@ class DiffReviewNext extends EditorAction { precondition: ContextKeyExpr.has('isInDiffEditor'), kbOpts: { kbExpr: null, - primary: KeyCode.F7 + primary: KeyCode.F7, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -832,7 +834,8 @@ class DiffReviewPrev extends EditorAction { precondition: ContextKeyExpr.has('isInDiffEditor'), kbOpts: { kbExpr: null, - primary: KeyMod.Shift | KeyCode.F7 + primary: KeyMod.Shift | KeyCode.F7, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/bracketMatching/bracketMatching.ts b/src/vs/editor/contrib/bracketMatching/bracketMatching.ts index b2573d26fa0..2071728a38e 100644 --- a/src/vs/editor/contrib/bracketMatching/bracketMatching.ts +++ b/src/vs/editor/contrib/bracketMatching/bracketMatching.ts @@ -22,6 +22,7 @@ import { ModelDecorationOptions } from 'vs/editor/common/model/textModel'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { registerColor } from 'vs/platform/theme/common/colorRegistry'; import { TrackedRangeStickiness, IModelDeltaDecoration, OverviewRulerLane } from 'vs/editor/common/model'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; const overviewRulerBracketMatchForeground = registerColor('editorOverviewRuler.bracketMatchForeground', { dark: '#A0A0A0', light: '#A0A0A0', hc: '#A0A0A0' }, nls.localize('overviewRulerBracketMatchForeground', 'Overview ruler marker color for matching brackets.')); @@ -34,7 +35,8 @@ class JumpToBracketAction extends EditorAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_BACKSLASH + primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_BACKSLASH, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/caretOperations/transpose.ts b/src/vs/editor/contrib/caretOperations/transpose.ts index 6523327b253..7de35d6f796 100644 --- a/src/vs/editor/contrib/caretOperations/transpose.ts +++ b/src/vs/editor/contrib/caretOperations/transpose.ts @@ -15,6 +15,7 @@ import { registerEditorAction, EditorAction, ServicesAccessor } from 'vs/editor/ import { ReplaceCommand } from 'vs/editor/common/commands/replaceCommand'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { ITextModel } from 'vs/editor/common/model'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; class TransposeLettersAction extends EditorAction { @@ -67,7 +68,8 @@ class TransposeLettersAction extends EditorAction { primary: 0, mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_T - } + }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/clipboard/clipboard.ts b/src/vs/editor/contrib/clipboard/clipboard.ts index 97f62935e1f..1c1ee451ef6 100644 --- a/src/vs/editor/contrib/clipboard/clipboard.ts +++ b/src/vs/editor/contrib/clipboard/clipboard.ts @@ -16,6 +16,7 @@ import { registerEditorAction, IActionOptions, EditorAction, ICommandKeybindings import { CopyOptions } from 'vs/editor/browser/controller/textAreaInput'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; const CLIPBOARD_CONTEXT_MENU_GROUP = '9_cutcopypaste'; @@ -62,7 +63,8 @@ class ExecCommandCutAction extends ExecCommandAction { let kbOpts: ICommandKeybindingsOptions = { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyCode.KEY_X, - win: { primary: KeyMod.CtrlCmd | KeyCode.KEY_X, secondary: [KeyMod.Shift | KeyCode.Delete] } + win: { primary: KeyMod.CtrlCmd | KeyCode.KEY_X, secondary: [KeyMod.Shift | KeyCode.Delete] }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() }; // Do not bind cut keybindings in the browser, // since browsers do that for us and it avoids security prompts @@ -99,7 +101,8 @@ class ExecCommandCopyAction extends ExecCommandAction { let kbOpts: ICommandKeybindingsOptions = { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyCode.KEY_C, - win: { primary: KeyMod.CtrlCmd | KeyCode.KEY_C, secondary: [KeyMod.CtrlCmd | KeyCode.Insert] } + win: { primary: KeyMod.CtrlCmd | KeyCode.KEY_C, secondary: [KeyMod.CtrlCmd | KeyCode.Insert] }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() }; // Do not bind copy keybindings in the browser, // since browsers do that for us and it avoids security prompts @@ -137,7 +140,8 @@ class ExecCommandPasteAction extends ExecCommandAction { let kbOpts: ICommandKeybindingsOptions = { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyCode.KEY_V, - win: { primary: KeyMod.CtrlCmd | KeyCode.KEY_V, secondary: [KeyMod.Shift | KeyCode.Insert] } + win: { primary: KeyMod.CtrlCmd | KeyCode.KEY_V, secondary: [KeyMod.Shift | KeyCode.Insert] }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() }; // Do not bind paste keybindings in the browser, // since browsers do that for us and it avoids security prompts @@ -169,7 +173,8 @@ class ExecCommandCopyWithSyntaxHighlightingAction extends ExecCommandAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.textInputFocus, - primary: null + primary: null, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/codeAction/codeActionCommands.ts b/src/vs/editor/contrib/codeAction/codeActionCommands.ts index 53870292126..773c7aa7243 100644 --- a/src/vs/editor/contrib/codeAction/codeActionCommands.ts +++ b/src/vs/editor/contrib/codeAction/codeActionCommands.ts @@ -26,6 +26,7 @@ import { CodeActionModel, CodeActionsComputeEvent, SUPPORTED_CODE_ACTIONS } from import { CodeActionAutoApply, CodeActionFilter, CodeActionKind } from './codeActionTrigger'; import { CodeActionContextMenu } from './codeActionWidget'; import { LightBulbWidget } from './lightBulbWidget'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; function contextKeyForSupportedActions(kind: CodeActionKind) { return ContextKeyExpr.regex( @@ -192,7 +193,8 @@ export class QuickFixAction extends EditorAction { precondition: ContextKeyExpr.and(EditorContextKeys.writable, EditorContextKeys.hasCodeActionsProvider), kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyMod.CtrlCmd | KeyCode.US_DOT + primary: KeyMod.CtrlCmd | KeyCode.US_DOT, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -272,7 +274,8 @@ export class RefactorAction extends EditorAction { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_R, mac: { primary: KeyMod.WinCtrl | KeyMod.Shift | KeyCode.KEY_R - } + }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() }, menuOpts: { group: '1_modification', @@ -335,7 +338,8 @@ export class OrganizeImportsAction extends EditorAction { contextKeyForSupportedActions(CodeActionKind.SourceOrganizeImports)), kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_O + primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_O, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/comment/comment.ts b/src/vs/editor/contrib/comment/comment.ts index b570ff1f041..38cf5fb416c 100644 --- a/src/vs/editor/contrib/comment/comment.ts +++ b/src/vs/editor/contrib/comment/comment.ts @@ -12,6 +12,7 @@ import { registerEditorAction, IActionOptions, EditorAction, ServicesAccessor } import { BlockCommentCommand } from './blockCommentCommand'; import { LineCommentCommand, Type } from './lineCommentCommand'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; abstract class CommentLineAction extends EditorAction { @@ -52,7 +53,8 @@ class ToggleCommentLineAction extends CommentLineAction { precondition: EditorContextKeys.writable, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyMod.CtrlCmd | KeyCode.US_SLASH + primary: KeyMod.CtrlCmd | KeyCode.US_SLASH, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -67,7 +69,8 @@ class AddLineCommentAction extends CommentLineAction { precondition: EditorContextKeys.writable, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_C) + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_C), + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -82,7 +85,8 @@ class RemoveLineCommentAction extends CommentLineAction { precondition: EditorContextKeys.writable, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_U) + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_U), + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -99,7 +103,8 @@ class BlockCommentAction extends EditorAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_A, - linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_A } + linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_A }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/contextmenu/contextmenu.ts b/src/vs/editor/contrib/contextmenu/contextmenu.ts index a3467f32a75..9049525c110 100644 --- a/src/vs/editor/contrib/contextmenu/contextmenu.ts +++ b/src/vs/editor/contrib/contextmenu/contextmenu.ts @@ -20,6 +20,7 @@ import { IEditorContribution, IScrollEvent, ScrollType } from 'vs/editor/common/ import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { registerEditorAction, registerEditorContribution, ServicesAccessor, EditorAction } from 'vs/editor/browser/editorExtensions'; import { ICodeEditor, IEditorMouseEvent, MouseTargetType } from 'vs/editor/browser/editorBrowser'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; export interface IPosition { x: number; @@ -227,7 +228,8 @@ class ShowContextMenu extends EditorAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.textInputFocus, - primary: KeyMod.Shift | KeyCode.F10 + primary: KeyMod.Shift | KeyCode.F10, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/cursorUndo/cursorUndo.ts b/src/vs/editor/contrib/cursorUndo/cursorUndo.ts index dec489e7d14..f2beb917e44 100644 --- a/src/vs/editor/contrib/cursorUndo/cursorUndo.ts +++ b/src/vs/editor/contrib/cursorUndo/cursorUndo.ts @@ -12,6 +12,7 @@ import { Disposable } from 'vs/base/common/lifecycle'; import { IEditorContribution, ScrollType } from 'vs/editor/common/editorCommon'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; class CursorState { readonly selections: Selection[]; @@ -118,7 +119,8 @@ export class CursorUndo extends EditorAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.textInputFocus, - primary: KeyMod.CtrlCmd | KeyCode.KEY_U + primary: KeyMod.CtrlCmd | KeyCode.KEY_U, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/find/findController.ts b/src/vs/editor/contrib/find/findController.ts index 73bf698e3b8..e4358fa14f5 100644 --- a/src/vs/editor/contrib/find/findController.ts +++ b/src/vs/editor/contrib/find/findController.ts @@ -386,7 +386,8 @@ export class StartFindAction extends EditorAction { precondition: null, kbOpts: { kbExpr: null, - primary: KeyMod.CtrlCmd | KeyCode.KEY_F + primary: KeyMod.CtrlCmd | KeyCode.KEY_F, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -418,7 +419,8 @@ export class StartFindWithSelectionAction extends EditorAction { primary: null, mac: { primary: KeyMod.CtrlCmd | KeyCode.KEY_E, - } + }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -467,7 +469,8 @@ export class NextMatchFindAction extends MatchFindAction { kbOpts: { kbExpr: EditorContextKeys.focus, primary: KeyCode.F3, - mac: { primary: KeyMod.CtrlCmd | KeyCode.KEY_G, secondary: [KeyCode.F3] } + mac: { primary: KeyMod.CtrlCmd | KeyCode.KEY_G, secondary: [KeyCode.F3] }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -488,7 +491,8 @@ export class PreviousMatchFindAction extends MatchFindAction { kbOpts: { kbExpr: EditorContextKeys.focus, primary: KeyMod.Shift | KeyCode.F3, - mac: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_G, secondary: [KeyMod.Shift | KeyCode.F3] } + mac: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_G, secondary: [KeyMod.Shift | KeyCode.F3] }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -533,7 +537,8 @@ export class NextSelectionMatchFindAction extends SelectionMatchFindAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.focus, - primary: KeyMod.CtrlCmd | KeyCode.F3 + primary: KeyMod.CtrlCmd | KeyCode.F3, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -553,7 +558,8 @@ export class PreviousSelectionMatchFindAction extends SelectionMatchFindAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.focus, - primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.F3 + primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.F3, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -574,7 +580,8 @@ export class StartFindReplaceAction extends EditorAction { kbOpts: { kbExpr: null, primary: KeyMod.CtrlCmd | KeyCode.KEY_H, - mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_F } + mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KEY_F }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/folding/folding.ts b/src/vs/editor/contrib/folding/folding.ts index 43a305a49bc..9aa9bcb6a86 100644 --- a/src/vs/editor/contrib/folding/folding.ts +++ b/src/vs/editor/contrib/folding/folding.ts @@ -32,6 +32,7 @@ import { FoldingRangeProviderRegistry, FoldingRangeKind } from 'vs/editor/common import { SyntaxRangeProvider, ID_SYNTAX_PROVIDER } from './syntaxRangeProvider'; import { CancellationToken } from 'vs/base/common/cancellation'; import { InitializingRangeProvider, ID_INIT_PROVIDER } from 'vs/editor/contrib/folding/intializingRangeProvider'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; export const ID = 'editor.contrib.folding'; @@ -486,7 +487,8 @@ class UnfoldAction extends FoldingAction { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_CLOSE_SQUARE_BRACKET, mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.US_CLOSE_SQUARE_BRACKET - } + }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() }, description: { description: 'Unfold the content in the editor', @@ -526,7 +528,8 @@ class UnFoldRecursivelyAction extends FoldingAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.US_CLOSE_SQUARE_BRACKET) + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.US_CLOSE_SQUARE_BRACKET), + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -549,7 +552,8 @@ class FoldAction extends FoldingAction { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_OPEN_SQUARE_BRACKET, mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.US_OPEN_SQUARE_BRACKET - } + }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() }, description: { description: 'Fold the content in the editor', @@ -589,7 +593,8 @@ class FoldRecursivelyAction extends FoldingAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.US_OPEN_SQUARE_BRACKET) + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.US_OPEN_SQUARE_BRACKET), + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -610,7 +615,8 @@ class FoldAllBlockCommentsAction extends FoldingAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.US_SLASH) + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.US_SLASH), + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -638,7 +644,8 @@ class FoldAllRegionsAction extends FoldingAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_8) + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_8), + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -666,7 +673,8 @@ class UnfoldAllRegionsAction extends FoldingAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_9) + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_9), + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -694,7 +702,8 @@ class FoldAllAction extends FoldingAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_0) + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_0), + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -714,7 +723,8 @@ class UnfoldAllAction extends FoldingAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_J) + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_J), + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -757,7 +767,8 @@ for (let i = 1; i <= 7; i++) { precondition: null, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | (KeyCode.KEY_0 + i)) + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | (KeyCode.KEY_0 + i)), + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }) ); diff --git a/src/vs/editor/contrib/format/formatActions.ts b/src/vs/editor/contrib/format/formatActions.ts index 985dd3e900e..e2db778084a 100644 --- a/src/vs/editor/contrib/format/formatActions.ts +++ b/src/vs/editor/contrib/format/formatActions.ts @@ -26,6 +26,7 @@ import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { ISingleEditOperation } from 'vs/editor/common/model'; import { INotificationService } from 'vs/platform/notification/common/notification'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; function alertFormattingEdits(edits: ISingleEditOperation[]): void { @@ -310,7 +311,8 @@ export class FormatDocumentAction extends AbstractFormatAction { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_F, // secondary: [KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_D)], - linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_I } + linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_I }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() }, menuOpts: { when: EditorContextKeys.hasDocumentFormattingProvider, @@ -341,7 +343,8 @@ export class FormatSelectionAction extends AbstractFormatAction { precondition: ContextKeyExpr.and(EditorContextKeys.writable, EditorContextKeys.hasNonEmptySelection), kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_F) + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_F), + weight: KeybindingsRegistry.WEIGHT.editorContrib() }, menuOpts: { when: ContextKeyExpr.and(EditorContextKeys.hasDocumentSelectionFormattingProvider, EditorContextKeys.hasNonEmptySelection), diff --git a/src/vs/editor/contrib/goToDefinition/goToDefinitionCommands.ts b/src/vs/editor/contrib/goToDefinition/goToDefinitionCommands.ts index 981b9fc99dc..827338a0c38 100644 --- a/src/vs/editor/contrib/goToDefinition/goToDefinitionCommands.ts +++ b/src/vs/editor/contrib/goToDefinition/goToDefinitionCommands.ts @@ -25,6 +25,7 @@ import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { ITextModel, IWordAtPosition } from 'vs/editor/common/model'; import { INotificationService } from 'vs/platform/notification/common/notification'; import { createCancelablePromise } from 'vs/base/common/async'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; export class DefinitionActionConfig { @@ -191,7 +192,8 @@ export class GoToDefinitionAction extends DefinitionAction { EditorContextKeys.isInEmbeddedEditor.toNegated()), kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: goToDeclarationKb + primary: goToDeclarationKb, + weight: KeybindingsRegistry.WEIGHT.editorContrib() }, menuOpts: { group: 'navigation', @@ -215,7 +217,8 @@ export class OpenDefinitionToSideAction extends DefinitionAction { EditorContextKeys.isInEmbeddedEditor.toNegated()), kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, goToDeclarationKb) + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, goToDeclarationKb), + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -234,7 +237,8 @@ export class PeekDefinitionAction extends DefinitionAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Alt | KeyCode.F12, - linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.F10 } + linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.F10 }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() }, menuOpts: { group: 'navigation', @@ -274,7 +278,8 @@ export class GoToImplementationAction extends ImplementationAction { EditorContextKeys.isInEmbeddedEditor.toNegated()), kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyMod.CtrlCmd | KeyCode.F12 + primary: KeyMod.CtrlCmd | KeyCode.F12, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -294,7 +299,8 @@ export class PeekImplementationAction extends ImplementationAction { EditorContextKeys.isInEmbeddedEditor.toNegated()), kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.F12 + primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.F12, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -330,7 +336,8 @@ export class GoToTypeDefinitionAction extends TypeDefinitionAction { EditorContextKeys.isInEmbeddedEditor.toNegated()), kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: 0 + primary: 0, + weight: KeybindingsRegistry.WEIGHT.editorContrib() }, menuOpts: { group: 'navigation', @@ -354,7 +361,8 @@ export class PeekTypeDefinitionAction extends TypeDefinitionAction { EditorContextKeys.isInEmbeddedEditor.toNegated()), kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: 0 + primary: 0, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/gotoError/gotoError.ts b/src/vs/editor/contrib/gotoError/gotoError.ts index 1c56024bc20..67da2b3d1af 100644 --- a/src/vs/editor/contrib/gotoError/gotoError.ts +++ b/src/vs/editor/contrib/gotoError/gotoError.ts @@ -401,7 +401,8 @@ class NextMarkerInFilesAction extends MarkerNavigationAction { precondition: EditorContextKeys.writable, kbOpts: { kbExpr: EditorContextKeys.focus, - primary: KeyCode.F8 + primary: KeyCode.F8, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -416,7 +417,8 @@ class PrevMarkerInFilesAction extends MarkerNavigationAction { precondition: EditorContextKeys.writable, kbOpts: { kbExpr: EditorContextKeys.focus, - primary: KeyMod.Shift | KeyCode.F8 + primary: KeyMod.Shift | KeyCode.F8, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/hover/hover.ts b/src/vs/editor/contrib/hover/hover.ts index 45f39711585..3ac5dd530f1 100644 --- a/src/vs/editor/contrib/hover/hover.ts +++ b/src/vs/editor/contrib/hover/hover.ts @@ -26,6 +26,7 @@ import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { MarkdownRenderer } from 'vs/editor/contrib/markdown/markdownRenderer'; import { IEmptyContentData } from 'vs/editor/browser/controller/mouseTarget'; import { HoverStartMode } from 'vs/editor/contrib/hover/hoverOperation'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; export class ModesHoverController implements IEditorContribution { @@ -250,7 +251,8 @@ class ShowHoverAction extends EditorAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_I) + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_I), + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/inPlaceReplace/inPlaceReplace.ts b/src/vs/editor/contrib/inPlaceReplace/inPlaceReplace.ts index 3127c005bfe..19d7c00d6dd 100644 --- a/src/vs/editor/contrib/inPlaceReplace/inPlaceReplace.ts +++ b/src/vs/editor/contrib/inPlaceReplace/inPlaceReplace.ts @@ -22,6 +22,7 @@ import { ModelDecorationOptions } from 'vs/editor/common/model/textModel'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { CancelablePromise, createCancelablePromise, timeout } from 'vs/base/common/async'; import { onUnexpectedError } from 'vs/base/common/errors'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; class InPlaceReplaceController implements IEditorContribution { @@ -142,7 +143,8 @@ class InPlaceReplaceUp extends EditorAction { precondition: EditorContextKeys.writable, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_COMMA + primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_COMMA, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -166,7 +168,8 @@ class InPlaceReplaceDown extends EditorAction { precondition: EditorContextKeys.writable, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_DOT + primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_DOT, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/linesOperations/linesOperations.ts b/src/vs/editor/contrib/linesOperations/linesOperations.ts index 7f2c9fb66c4..8752f7a1abd 100644 --- a/src/vs/editor/contrib/linesOperations/linesOperations.ts +++ b/src/vs/editor/contrib/linesOperations/linesOperations.ts @@ -23,6 +23,7 @@ import { MoveLinesCommand } from './moveLinesCommand'; import { TypeOperations } from 'vs/editor/common/controller/cursorTypeOperations'; import { CoreEditingCommands } from 'vs/editor/browser/controller/coreCommands'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; // copy lines @@ -60,7 +61,8 @@ class CopyLinesUpAction extends AbstractCopyLinesAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Alt | KeyMod.Shift | KeyCode.UpArrow, - linux: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.Shift | KeyCode.UpArrow } + linux: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.Shift | KeyCode.UpArrow }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -76,7 +78,8 @@ class CopyLinesDownAction extends AbstractCopyLinesAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Alt | KeyMod.Shift | KeyCode.DownArrow, - linux: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.Shift | KeyCode.DownArrow } + linux: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.Shift | KeyCode.DownArrow }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -119,7 +122,8 @@ class MoveLinesUpAction extends AbstractMoveLinesAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Alt | KeyCode.UpArrow, - linux: { primary: KeyMod.Alt | KeyCode.UpArrow } + linux: { primary: KeyMod.Alt | KeyCode.UpArrow }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -135,7 +139,8 @@ class MoveLinesDownAction extends AbstractMoveLinesAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Alt | KeyCode.DownArrow, - linux: { primary: KeyMod.Alt | KeyCode.DownArrow } + linux: { primary: KeyMod.Alt | KeyCode.DownArrow }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -204,7 +209,8 @@ export class TrimTrailingWhitespaceAction extends EditorAction { precondition: EditorContextKeys.writable, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_X) + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_X), + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -245,7 +251,8 @@ class DeleteLinesAction extends EditorAction { precondition: EditorContextKeys.writable, kbOpts: { kbExpr: EditorContextKeys.textInputFocus, - primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_K + primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_K, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -314,7 +321,8 @@ export class IndentLinesAction extends EditorAction { precondition: EditorContextKeys.writable, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyMod.CtrlCmd | KeyCode.US_CLOSE_SQUARE_BRACKET + primary: KeyMod.CtrlCmd | KeyCode.US_CLOSE_SQUARE_BRACKET, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -335,7 +343,8 @@ class OutdentLinesAction extends EditorAction { precondition: EditorContextKeys.writable, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyMod.CtrlCmd | KeyCode.US_OPEN_SQUARE_BRACKET + primary: KeyMod.CtrlCmd | KeyCode.US_OPEN_SQUARE_BRACKET, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -354,7 +363,8 @@ export class InsertLineBeforeAction extends EditorAction { precondition: EditorContextKeys.writable, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.Enter + primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.Enter, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -374,7 +384,8 @@ export class InsertLineAfterAction extends EditorAction { precondition: EditorContextKeys.writable, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyMod.CtrlCmd | KeyCode.Enter + primary: KeyMod.CtrlCmd | KeyCode.Enter, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -434,7 +445,8 @@ export class DeleteAllLeftAction extends AbstractDeleteAllToBoundaryAction { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: null, - mac: { primary: KeyMod.CtrlCmd | KeyCode.Backspace } + mac: { primary: KeyMod.CtrlCmd | KeyCode.Backspace }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -502,7 +514,8 @@ export class DeleteAllRightAction extends AbstractDeleteAllToBoundaryAction { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: null, - mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_K, secondary: [KeyMod.CtrlCmd | KeyCode.Delete] } + mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_K, secondary: [KeyMod.CtrlCmd | KeyCode.Delete] }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -559,7 +572,8 @@ export class JoinLinesAction extends EditorAction { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: 0, - mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_J } + mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_J }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/multicursor/multicursor.ts b/src/vs/editor/contrib/multicursor/multicursor.ts index 0517d7061a5..528f016f635 100644 --- a/src/vs/editor/contrib/multicursor/multicursor.ts +++ b/src/vs/editor/contrib/multicursor/multicursor.ts @@ -25,6 +25,7 @@ import { overviewRulerSelectionHighlightForeground } from 'vs/platform/theme/com import { themeColorFromId } from 'vs/platform/theme/common/themeService'; import { INewFindReplaceState, FindOptionOverride } from 'vs/editor/contrib/find/findState'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; export class InsertCursorAbove extends EditorAction { @@ -40,7 +41,8 @@ export class InsertCursorAbove extends EditorAction { linux: { primary: KeyMod.Shift | KeyMod.Alt | KeyCode.UpArrow, secondary: [KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.UpArrow] - } + }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -78,7 +80,8 @@ export class InsertCursorBelow extends EditorAction { linux: { primary: KeyMod.Shift | KeyMod.Alt | KeyCode.DownArrow, secondary: [KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.DownArrow] - } + }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -112,7 +115,8 @@ class InsertCursorAtEndOfEachLineSelected extends EditorAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_I + primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_I, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -522,7 +526,8 @@ export class AddSelectionToNextFindMatchAction extends MultiCursorSelectionContr precondition: null, kbOpts: { kbExpr: EditorContextKeys.focus, - primary: KeyMod.CtrlCmd | KeyCode.KEY_D + primary: KeyMod.CtrlCmd | KeyCode.KEY_D, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -554,7 +559,8 @@ export class MoveSelectionToNextFindMatchAction extends MultiCursorSelectionCont precondition: null, kbOpts: { kbExpr: EditorContextKeys.focus, - primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_D) + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_D), + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -586,7 +592,8 @@ export class SelectHighlightsAction extends MultiCursorSelectionControllerAction precondition: null, kbOpts: { kbExpr: EditorContextKeys.focus, - primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_L + primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_L, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -604,7 +611,8 @@ export class CompatChangeAll extends MultiCursorSelectionControllerAction { precondition: EditorContextKeys.writable, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyMod.CtrlCmd | KeyCode.F2 + primary: KeyMod.CtrlCmd | KeyCode.F2, + weight: KeybindingsRegistry.WEIGHT.editorContrib() }, menuOpts: { group: '1_modification', diff --git a/src/vs/editor/contrib/parameterHints/parameterHints.ts b/src/vs/editor/contrib/parameterHints/parameterHints.ts index 92d7eb7a799..5c856791d50 100644 --- a/src/vs/editor/contrib/parameterHints/parameterHints.ts +++ b/src/vs/editor/contrib/parameterHints/parameterHints.ts @@ -68,7 +68,8 @@ export class TriggerParameterHintsAction extends EditorAction { precondition: EditorContextKeys.hasSignatureHelpProvider, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.Space + primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.Space, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/referenceSearch/referenceSearch.ts b/src/vs/editor/contrib/referenceSearch/referenceSearch.ts index ff8515fdd1e..cc5974cf302 100644 --- a/src/vs/editor/contrib/referenceSearch/referenceSearch.ts +++ b/src/vs/editor/contrib/referenceSearch/referenceSearch.ts @@ -70,7 +70,8 @@ export class ReferenceAction extends EditorAction { EditorContextKeys.isInEmbeddedEditor.toNegated()), kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyMod.Shift | KeyCode.F12 + primary: KeyMod.Shift | KeyCode.F12, + weight: KeybindingsRegistry.WEIGHT.editorContrib() }, menuOpts: { group: 'navigation', diff --git a/src/vs/editor/contrib/rename/rename.ts b/src/vs/editor/contrib/rename/rename.ts index d83828e5695..42f35cefac4 100644 --- a/src/vs/editor/contrib/rename/rename.ts +++ b/src/vs/editor/contrib/rename/rename.ts @@ -224,7 +224,8 @@ export class RenameAction extends EditorAction { precondition: ContextKeyExpr.and(EditorContextKeys.writable, EditorContextKeys.hasRenameProvider), kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyCode.F2 + primary: KeyCode.F2, + weight: KeybindingsRegistry.WEIGHT.editorContrib() }, menuOpts: { group: '1_modification', diff --git a/src/vs/editor/contrib/smartSelect/smartSelect.ts b/src/vs/editor/contrib/smartSelect/smartSelect.ts index 7c25548d3c9..b900d5011b2 100644 --- a/src/vs/editor/contrib/smartSelect/smartSelect.ts +++ b/src/vs/editor/contrib/smartSelect/smartSelect.ts @@ -16,6 +16,7 @@ import { registerEditorAction, ServicesAccessor, IActionOptions, EditorAction, r import { TokenSelectionSupport, ILogicalSelectionEntry } from './tokenSelectionSupport'; import { ICursorPositionChangedEvent } from 'vs/editor/common/controller/cursorEvents'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; // --- selection state machine @@ -173,7 +174,8 @@ class GrowSelectionAction extends AbstractSmartSelect { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Shift | KeyMod.Alt | KeyCode.RightArrow, - mac: { primary: KeyMod.CtrlCmd | KeyMod.WinCtrl | KeyMod.Shift | KeyCode.RightArrow } + mac: { primary: KeyMod.CtrlCmd | KeyMod.WinCtrl | KeyMod.Shift | KeyCode.RightArrow }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -189,7 +191,8 @@ class ShrinkSelectionAction extends AbstractSmartSelect { kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Shift | KeyMod.Alt | KeyCode.LeftArrow, - mac: { primary: KeyMod.CtrlCmd | KeyMod.WinCtrl | KeyMod.Shift | KeyCode.LeftArrow } + mac: { primary: KeyMod.CtrlCmd | KeyMod.WinCtrl | KeyMod.Shift | KeyCode.LeftArrow }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/suggest/suggestController.ts b/src/vs/editor/contrib/suggest/suggestController.ts index f92c3459f73..58214089da4 100644 --- a/src/vs/editor/contrib/suggest/suggestController.ts +++ b/src/vs/editor/contrib/suggest/suggestController.ts @@ -325,7 +325,8 @@ export class TriggerSuggestAction extends EditorAction { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyCode.Space, - mac: { primary: KeyMod.WinCtrl | KeyCode.Space } + mac: { primary: KeyMod.WinCtrl | KeyCode.Space }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/toggleTabFocusMode/toggleTabFocusMode.ts b/src/vs/editor/contrib/toggleTabFocusMode/toggleTabFocusMode.ts index e3aa3349af1..e71d465233f 100644 --- a/src/vs/editor/contrib/toggleTabFocusMode/toggleTabFocusMode.ts +++ b/src/vs/editor/contrib/toggleTabFocusMode/toggleTabFocusMode.ts @@ -9,6 +9,7 @@ import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import { registerEditorAction, ServicesAccessor, EditorAction } from 'vs/editor/browser/editorExtensions'; import { TabFocus } from 'vs/editor/common/config/commonEditorConfig'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; export class ToggleTabFocusModeAction extends EditorAction { @@ -23,7 +24,8 @@ export class ToggleTabFocusModeAction extends EditorAction { kbOpts: { kbExpr: null, primary: KeyMod.CtrlCmd | KeyCode.KEY_M, - mac: { primary: KeyMod.WinCtrl | KeyMod.Shift | KeyCode.KEY_M } + mac: { primary: KeyMod.WinCtrl | KeyMod.Shift | KeyCode.KEY_M }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/wordHighlighter/wordHighlighter.ts b/src/vs/editor/contrib/wordHighlighter/wordHighlighter.ts index 7f21bc957a1..be9f60bf3e4 100644 --- a/src/vs/editor/contrib/wordHighlighter/wordHighlighter.ts +++ b/src/vs/editor/contrib/wordHighlighter/wordHighlighter.ts @@ -25,6 +25,7 @@ import { firstIndex, isFalsyOrEmpty } from 'vs/base/common/arrays'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { ITextModel, TrackedRangeStickiness, OverviewRulerLane, IModelDeltaDecoration } from 'vs/editor/common/model'; import { CancellationToken } from 'vs/base/common/cancellation'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; export const editorWordHighlight = registerColor('editor.wordHighlightBackground', { dark: '#575757B8', light: '#57575740', hc: null }, nls.localize('wordHighlight', 'Background color of a symbol during read-access, like reading a variable. The color must not be opaque to not hide underlying decorations.'), true); export const editorWordHighlightStrong = registerColor('editor.wordHighlightStrongBackground', { dark: '#004972B8', light: '#0e639c40', hc: null }, nls.localize('wordHighlightStrong', 'Background color of a symbol during write-access, like writing to a variable. The color must not be opaque to not hide underlying decorations.'), true); @@ -459,7 +460,8 @@ class NextWordHighlightAction extends WordHighlightNavigationAction { precondition: ctxHasWordHighlights, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyCode.F7 + primary: KeyCode.F7, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -474,7 +476,8 @@ class PrevWordHighlightAction extends WordHighlightNavigationAction { precondition: ctxHasWordHighlights, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyMod.Shift | KeyCode.F7 + primary: KeyMod.Shift | KeyCode.F7, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/wordOperations/wordOperations.ts b/src/vs/editor/contrib/wordOperations/wordOperations.ts index 528303ab72c..7d94b1a2372 100644 --- a/src/vs/editor/contrib/wordOperations/wordOperations.ts +++ b/src/vs/editor/contrib/wordOperations/wordOperations.ts @@ -19,6 +19,7 @@ import { getMapForWordSeparators, WordCharacterClassifier } from 'vs/editor/comm import { CursorState } from 'vs/editor/common/controller/cursorCommon'; import { CursorChangeReason } from 'vs/editor/common/controller/cursorEvents'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; export interface MoveWordOptions extends ICommandOptions { inSelectionMode: boolean; @@ -100,7 +101,8 @@ export class CursorWordStartLeft extends WordLeftCommand { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyCode.LeftArrow, - mac: { primary: KeyMod.Alt | KeyCode.LeftArrow } + mac: { primary: KeyMod.Alt | KeyCode.LeftArrow }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -138,7 +140,8 @@ export class CursorWordStartLeftSelect extends WordLeftCommand { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.LeftArrow, - mac: { primary: KeyMod.Alt | KeyMod.Shift | KeyCode.LeftArrow } + mac: { primary: KeyMod.Alt | KeyMod.Shift | KeyCode.LeftArrow }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -187,7 +190,8 @@ export class CursorWordEndRight extends WordRightCommand { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyCode.RightArrow, - mac: { primary: KeyMod.Alt | KeyCode.RightArrow } + mac: { primary: KeyMod.Alt | KeyCode.RightArrow }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -225,7 +229,8 @@ export class CursorWordEndRightSelect extends WordRightCommand { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.RightArrow, - mac: { primary: KeyMod.Alt | KeyMod.Shift | KeyCode.RightArrow } + mac: { primary: KeyMod.Alt | KeyMod.Shift | KeyCode.RightArrow }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -330,7 +335,8 @@ export class DeleteWordLeft extends DeleteWordLeftCommand { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyCode.Backspace, - mac: { primary: KeyMod.Alt | KeyCode.Backspace } + mac: { primary: KeyMod.Alt | KeyCode.Backspace }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -368,7 +374,8 @@ export class DeleteWordRight extends DeleteWordRightCommand { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyCode.Delete, - mac: { primary: KeyMod.Alt | KeyCode.Delete } + mac: { primary: KeyMod.Alt | KeyCode.Delete }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/contrib/wordPartOperations/wordPartOperations.ts b/src/vs/editor/contrib/wordPartOperations/wordPartOperations.ts index 28829ba7b31..942747eeb30 100644 --- a/src/vs/editor/contrib/wordPartOperations/wordPartOperations.ts +++ b/src/vs/editor/contrib/wordPartOperations/wordPartOperations.ts @@ -15,6 +15,7 @@ import { WordNavigationType, WordPartOperations } from 'vs/editor/common/control import { WordCharacterClassifier } from 'vs/editor/common/controller/wordCharacterClassifier'; import { DeleteWordCommand, MoveWordCommand } from '../wordOperations/wordOperations'; import { Position } from 'vs/editor/common/core/position'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; export class DeleteWordPartLeft extends DeleteWordCommand { constructor() { @@ -26,7 +27,8 @@ export class DeleteWordPartLeft extends DeleteWordCommand { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.Backspace, - mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyCode.Backspace } + mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyCode.Backspace }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -50,7 +52,8 @@ export class DeleteWordPartRight extends DeleteWordCommand { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.Delete, - mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyCode.Delete } + mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyCode.Delete }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -81,7 +84,8 @@ export class CursorWordPartLeft extends WordPartLeftCommand { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.LeftArrow, - mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyCode.LeftArrow } + mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyCode.LeftArrow }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -96,7 +100,8 @@ export class CursorWordPartLeftSelect extends WordPartLeftCommand { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.Shift | KeyCode.LeftArrow, - mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyMod.Shift | KeyCode.LeftArrow } + mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyMod.Shift | KeyCode.LeftArrow }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -117,7 +122,8 @@ export class CursorWordPartRight extends WordPartRightCommand { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.RightArrow, - mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyCode.RightArrow } + mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyCode.RightArrow }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -132,7 +138,8 @@ export class CursorWordPartRightSelect extends WordPartRightCommand { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyMod.Shift | KeyCode.RightArrow, - mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyMod.Shift | KeyCode.RightArrow } + mac: { primary: KeyMod.WinCtrl | KeyMod.Alt | KeyMod.Shift | KeyCode.RightArrow }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.ts b/src/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.ts index 7f6504e4607..f56ba68928d 100644 --- a/src/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.ts +++ b/src/vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp.ts @@ -342,7 +342,8 @@ class ShowAccessibilityHelpAction extends EditorAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.focus, - primary: (browser.isIE ? KeyMod.CtrlCmd | KeyCode.F1 : KeyMod.Alt | KeyCode.F1) + primary: (browser.isIE ? KeyMod.CtrlCmd | KeyCode.F1 : KeyMod.Alt | KeyCode.F1), + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/standalone/browser/quickOpen/gotoLine.ts b/src/vs/editor/standalone/browser/quickOpen/gotoLine.ts index 9f83d8111c9..680de38a680 100644 --- a/src/vs/editor/standalone/browser/quickOpen/gotoLine.ts +++ b/src/vs/editor/standalone/browser/quickOpen/gotoLine.ts @@ -18,6 +18,7 @@ import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import { Position } from 'vs/editor/common/core/position'; import { Range } from 'vs/editor/common/core/range'; import { ITextModel } from 'vs/editor/common/model'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; interface ParseResult { position: Position; @@ -153,7 +154,8 @@ export class GotoLineAction extends BaseEditorQuickOpenAction { kbOpts: { kbExpr: EditorContextKeys.focus, primary: KeyMod.CtrlCmd | KeyCode.KEY_G, - mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_G } + mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_G }, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/editor/standalone/browser/quickOpen/quickCommand.ts b/src/vs/editor/standalone/browser/quickOpen/quickCommand.ts index e44e14c0da8..1ccd2cb33bc 100644 --- a/src/vs/editor/standalone/browser/quickOpen/quickCommand.ts +++ b/src/vs/editor/standalone/browser/quickOpen/quickCommand.ts @@ -18,6 +18,7 @@ import { registerEditorAction, ServicesAccessor } from 'vs/editor/browser/editor import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import * as browser from 'vs/base/browser/browser'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; export class EditorActionCommandEntry extends QuickOpenEntryGroup { private key: string; @@ -79,7 +80,8 @@ export class QuickCommandAction extends BaseEditorQuickOpenAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.focus, - primary: (browser.isIE ? KeyMod.Alt | KeyCode.F1 : KeyCode.F1) + primary: (browser.isIE ? KeyMod.Alt | KeyCode.F1 : KeyCode.F1), + weight: KeybindingsRegistry.WEIGHT.editorContrib() }, menuOpts: { } diff --git a/src/vs/editor/standalone/browser/quickOpen/quickOutline.ts b/src/vs/editor/standalone/browser/quickOpen/quickOutline.ts index 19eeda1c9cc..c2ae838ae8d 100644 --- a/src/vs/editor/standalone/browser/quickOpen/quickOutline.ts +++ b/src/vs/editor/standalone/browser/quickOpen/quickOutline.ts @@ -22,6 +22,7 @@ import { registerEditorAction, ServicesAccessor } from 'vs/editor/browser/editor import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import { Range, IRange } from 'vs/editor/common/core/range'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; let SCOPE_PREFIX = ':'; @@ -120,7 +121,8 @@ export class QuickOutlineAction extends BaseEditorQuickOpenAction { precondition: EditorContextKeys.hasDocumentSymbolProvider, kbOpts: { kbExpr: EditorContextKeys.focus, - primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_O + primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_O, + weight: KeybindingsRegistry.WEIGHT.editorContrib() }, menuOpts: { group: 'navigation', diff --git a/src/vs/workbench/parts/codeEditor/electron-browser/accessibility.ts b/src/vs/workbench/parts/codeEditor/electron-browser/accessibility.ts index a9e4ec6741e..f694743fb2c 100644 --- a/src/vs/workbench/parts/codeEditor/electron-browser/accessibility.ts +++ b/src/vs/workbench/parts/codeEditor/electron-browser/accessibility.ts @@ -286,7 +286,8 @@ class ShowAccessibilityHelpAction extends EditorAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.focus, - primary: KeyMod.Alt | KeyCode.F1 + primary: KeyMod.Alt | KeyCode.F1, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/workbench/parts/codeEditor/electron-browser/toggleWordWrap.ts b/src/vs/workbench/parts/codeEditor/electron-browser/toggleWordWrap.ts index 882cd01e68b..b81dea044c7 100644 --- a/src/vs/workbench/parts/codeEditor/electron-browser/toggleWordWrap.ts +++ b/src/vs/workbench/parts/codeEditor/electron-browser/toggleWordWrap.ts @@ -18,6 +18,7 @@ import { InternalEditorOptions, EDITOR_DEFAULTS } from 'vs/editor/common/config/ import { ITextResourceConfigurationService } from 'vs/editor/common/services/resourceConfiguration'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { INotificationService } from 'vs/platform/notification/common/notification'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; const transientWordWrapState = 'transientWordWrapState'; const isWordWrapMinifiedKey = 'isWordWrapMinified'; @@ -141,7 +142,8 @@ class ToggleWordWrapAction extends EditorAction { precondition: null, kbOpts: { kbExpr: null, - primary: KeyMod.Alt | KeyCode.KEY_Z + primary: KeyMod.Alt | KeyCode.KEY_Z, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/workbench/parts/debug/browser/debugEditorActions.ts b/src/vs/workbench/parts/debug/browser/debugEditorActions.ts index a8e56c2bc4c..a8224ca4ce8 100644 --- a/src/vs/workbench/parts/debug/browser/debugEditorActions.ts +++ b/src/vs/workbench/parts/debug/browser/debugEditorActions.ts @@ -16,6 +16,7 @@ import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { openBreakpointSource } from 'vs/workbench/parts/debug/browser/breakpointsView'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; export const TOGGLE_BREAKPOINT_ID = 'editor.debug.action.toggleBreakpoint'; class ToggleBreakpointAction extends EditorAction { @@ -27,7 +28,8 @@ class ToggleBreakpointAction extends EditorAction { precondition: null, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyCode.F9 + primary: KeyCode.F9, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -197,7 +199,8 @@ class ShowDebugHoverAction extends EditorAction { precondition: CONTEXT_IN_DEBUG_MODE, kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_I) + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_I), + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/workbench/parts/debug/electron-browser/breakpointWidget.ts b/src/vs/workbench/parts/debug/electron-browser/breakpointWidget.ts index b6781653be4..7e2a5443ce8 100644 --- a/src/vs/workbench/parts/debug/electron-browser/breakpointWidget.ts +++ b/src/vs/workbench/parts/debug/electron-browser/breakpointWidget.ts @@ -33,6 +33,7 @@ import { transparent, editorForeground } from 'vs/platform/theme/common/colorReg import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; import { IDecorationOptions } from 'vs/editor/common/editorCommon'; import { CodeEditorWidget } from 'vs/editor/browser/widget/codeEditorWidget'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; const $ = dom.$; const IPrivateBreakpointWidgetService = createDecorator('privateBreakopintWidgetService'); @@ -296,7 +297,8 @@ class AcceptBreakpointWidgetInputAction extends EditorCommand { precondition: CONTEXT_BREAKPOINT_WIDGET_VISIBLE, kbOpts: { kbExpr: CONTEXT_IN_BREAKPOINT_WIDGET, - primary: KeyCode.Enter + primary: KeyCode.Enter, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -315,7 +317,8 @@ class CloseBreakpointWidgetCommand extends EditorCommand { kbOpts: { kbExpr: EditorContextKeys.textInputFocus, primary: KeyCode.Escape, - secondary: [KeyMod.Shift | KeyCode.Escape] + secondary: [KeyMod.Shift | KeyCode.Escape], + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/workbench/parts/debug/electron-browser/repl.ts b/src/vs/workbench/parts/debug/electron-browser/repl.ts index fdd2f9ac975..6d38eab3e4d 100644 --- a/src/vs/workbench/parts/debug/electron-browser/repl.ts +++ b/src/vs/workbench/parts/debug/electron-browser/repl.ts @@ -47,6 +47,7 @@ import { IDebugService, REPL_ID, DEBUG_SCHEME, CONTEXT_IN_DEBUG_REPL } from 'vs/ import { HistoryNavigator } from 'vs/base/common/history'; import { IHistoryNavigationWidget } from 'vs/base/browser/history'; import { createAndBindHistoryNavigationWidgetScopedContextKeyService } from 'vs/platform/widget/browser/contextScopedHistoryWidget'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; const $ = dom.$; @@ -315,7 +316,8 @@ class AcceptReplInputAction extends EditorAction { precondition: CONTEXT_IN_DEBUG_REPL, kbOpts: { kbExpr: EditorContextKeys.textInputFocus, - primary: KeyCode.Enter + primary: KeyCode.Enter, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/workbench/parts/emmet/electron-browser/actions/expandAbbreviation.ts b/src/vs/workbench/parts/emmet/electron-browser/actions/expandAbbreviation.ts index 5a9512f8999..4532d781d2f 100644 --- a/src/vs/workbench/parts/emmet/electron-browser/actions/expandAbbreviation.ts +++ b/src/vs/workbench/parts/emmet/electron-browser/actions/expandAbbreviation.ts @@ -10,6 +10,7 @@ import { registerEditorAction } from 'vs/editor/browser/editorExtensions'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { KeyCode } from 'vs/base/common/keyCodes'; import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; class ExpandAbbreviationAction extends EmmetEditorAction { @@ -26,7 +27,8 @@ class ExpandAbbreviationAction extends EmmetEditorAction { EditorContextKeys.editorTextFocus, EditorContextKeys.tabDoesNotMoveFocus, ContextKeyExpr.has('config.emmet.triggerExpansionOnTab') - ) + ), + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); diff --git a/src/vs/workbench/parts/extensions/electron-browser/extensionEditor.ts b/src/vs/workbench/parts/extensions/electron-browser/extensionEditor.ts index 26b12485999..632412c5313 100644 --- a/src/vs/workbench/parts/extensions/electron-browser/extensionEditor.ts +++ b/src/vs/workbench/parts/extensions/electron-browser/extensionEditor.ts @@ -1121,7 +1121,8 @@ const showCommand = new ShowExtensionEditorFindCommand({ id: 'editor.action.extensioneditor.showfind', precondition: KEYBINDING_CONTEXT_EXTENSIONEDITOR_WEBVIEW_FOCUS, kbOpts: { - primary: KeyMod.CtrlCmd | KeyCode.KEY_F + primary: KeyMod.CtrlCmd | KeyCode.KEY_F, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); -showCommand.register(KeybindingsRegistry.WEIGHT.editorContrib()); +showCommand.register(); diff --git a/src/vs/workbench/parts/preferences/browser/keybindingsEditorContribution.ts b/src/vs/workbench/parts/preferences/browser/keybindingsEditorContribution.ts index 2a3fab73b51..30a65e1aaa0 100644 --- a/src/vs/workbench/parts/preferences/browser/keybindingsEditorContribution.ts +++ b/src/vs/workbench/parts/preferences/browser/keybindingsEditorContribution.ts @@ -29,6 +29,7 @@ import { WindowsNativeResolvedKeybinding } from 'vs/workbench/services/keybindin import { themeColorFromId, ThemeColor } from 'vs/platform/theme/common/themeService'; import { overviewRulerInfo, overviewRulerError } from 'vs/editor/common/view/editorColorRegistry'; import { IModelDeltaDecoration, ITextModel, TrackedRangeStickiness, OverviewRulerLane } from 'vs/editor/common/model'; +import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; const NLS_LAUNCH_MESSAGE = nls.localize('defineKeybinding.start', "Define Keybinding"); const NLS_KB_LAYOUT_ERROR_MESSAGE = nls.localize('defineKeybinding.kbLayoutErrorMessage', "You won't be able to produce this key combination under your current keyboard layout."); @@ -365,7 +366,8 @@ class DefineKeybindingCommand extends EditorCommand { precondition: ContextKeyExpr.and(EditorContextKeys.writable, EditorContextKeys.languageId.isEqualTo('jsonc')), kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, - primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_K) + primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_K), + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/workbench/parts/preferences/electron-browser/preferences.contribution.ts b/src/vs/workbench/parts/preferences/electron-browser/preferences.contribution.ts index cb4dd53b20e..fb41da7a3f1 100644 --- a/src/vs/workbench/parts/preferences/electron-browser/preferences.contribution.ts +++ b/src/vs/workbench/parts/preferences/electron-browser/preferences.contribution.ts @@ -351,9 +351,9 @@ class StartSearchDefaultSettingsCommand extends SettingsCommand { const startSearchCommand = new StartSearchDefaultSettingsCommand({ id: SETTINGS_EDITOR_COMMAND_SEARCH, precondition: ContextKeyExpr.and(CONTEXT_SETTINGS_EDITOR), - kbOpts: { primary: KeyMod.CtrlCmd | KeyCode.KEY_F } + kbOpts: { primary: KeyMod.CtrlCmd | KeyCode.KEY_F, weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); -startSearchCommand.register(KeybindingsRegistry.WEIGHT.editorContrib()); +startSearchCommand.register(); class FocusSearchFromSettingsCommand extends SettingsCommand { @@ -367,9 +367,9 @@ class FocusSearchFromSettingsCommand extends SettingsCommand { const focusSearchFromSettingsCommand = new FocusSearchFromSettingsCommand({ id: SETTINGS_EDITOR_COMMAND_FOCUS_SEARCH_FROM_SETTINGS, precondition: ContextKeyExpr.and(CONTEXT_SETTINGS_EDITOR, CONTEXT_SETTINGS_FIRST_ROW_FOCUS), - kbOpts: { primary: KeyCode.UpArrow } + kbOpts: { primary: KeyCode.UpArrow, weight: KeybindingsRegistry.WEIGHT.workbenchContrib() } }); -focusSearchFromSettingsCommand.register(KeybindingsRegistry.WEIGHT.workbenchContrib()); +focusSearchFromSettingsCommand.register(); class ClearSearchResultsCommand extends SettingsCommand { @@ -384,9 +384,9 @@ class ClearSearchResultsCommand extends SettingsCommand { const clearSearchResultsCommand = new ClearSearchResultsCommand({ id: SETTINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS, precondition: CONTEXT_SETTINGS_SEARCH_FOCUS, - kbOpts: { primary: KeyCode.Escape } + kbOpts: { primary: KeyCode.Escape, weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); -clearSearchResultsCommand.register(KeybindingsRegistry.WEIGHT.editorContrib()); +clearSearchResultsCommand.register(); class FocusSettingsFileEditorCommand extends SettingsCommand { @@ -402,16 +402,16 @@ class FocusSettingsFileEditorCommand extends SettingsCommand { const focusSettingsFileEditorCommand = new FocusSettingsFileEditorCommand({ id: SETTINGS_EDITOR_COMMAND_FOCUS_FILE, precondition: CONTEXT_SETTINGS_SEARCH_FOCUS, - kbOpts: { primary: KeyCode.DownArrow } + kbOpts: { primary: KeyCode.DownArrow, weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); -focusSettingsFileEditorCommand.register(KeybindingsRegistry.WEIGHT.editorContrib()); +focusSettingsFileEditorCommand.register(); const focusSettingsFromSearchCommand = new FocusSettingsFileEditorCommand({ id: SETTINGS_EDITOR_COMMAND_FOCUS_SETTINGS_FROM_SEARCH, precondition: CONTEXT_SETTINGS_SEARCH_FOCUS, - kbOpts: { primary: KeyCode.DownArrow } + kbOpts: { primary: KeyCode.DownArrow, weight: KeybindingsRegistry.WEIGHT.workbenchContrib() } }); -focusSettingsFromSearchCommand.register(KeybindingsRegistry.WEIGHT.workbenchContrib()); +focusSettingsFromSearchCommand.register(); class FocusNextSearchResultCommand extends SettingsCommand { @@ -425,9 +425,9 @@ class FocusNextSearchResultCommand extends SettingsCommand { const focusNextSearchResultCommand = new FocusNextSearchResultCommand({ id: SETTINGS_EDITOR_COMMAND_FOCUS_NEXT_SETTING, precondition: CONTEXT_SETTINGS_SEARCH_FOCUS, - kbOpts: { primary: KeyCode.Enter } + kbOpts: { primary: KeyCode.Enter, weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); -focusNextSearchResultCommand.register(KeybindingsRegistry.WEIGHT.editorContrib()); +focusNextSearchResultCommand.register(); class FocusPreviousSearchResultCommand extends SettingsCommand { @@ -441,9 +441,9 @@ class FocusPreviousSearchResultCommand extends SettingsCommand { const focusPreviousSearchResultCommand = new FocusPreviousSearchResultCommand({ id: SETTINGS_EDITOR_COMMAND_FOCUS_PREVIOUS_SETTING, precondition: CONTEXT_SETTINGS_SEARCH_FOCUS, - kbOpts: { primary: KeyMod.Shift | KeyCode.Enter } + kbOpts: { primary: KeyMod.Shift | KeyCode.Enter, weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); -focusPreviousSearchResultCommand.register(KeybindingsRegistry.WEIGHT.editorContrib()); +focusPreviousSearchResultCommand.register(); class EditFocusedSettingCommand extends SettingsCommand { @@ -457,9 +457,9 @@ class EditFocusedSettingCommand extends SettingsCommand { const editFocusedSettingCommand = new EditFocusedSettingCommand({ id: SETTINGS_EDITOR_COMMAND_EDIT_FOCUSED_SETTING, precondition: CONTEXT_SETTINGS_SEARCH_FOCUS, - kbOpts: { primary: KeyMod.CtrlCmd | KeyCode.US_DOT } + kbOpts: { primary: KeyMod.CtrlCmd | KeyCode.US_DOT, weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); -editFocusedSettingCommand.register(KeybindingsRegistry.WEIGHT.editorContrib()); +editFocusedSettingCommand.register(); class EditFocusedSettingCommand2 extends SettingsCommand { @@ -474,9 +474,9 @@ class EditFocusedSettingCommand2 extends SettingsCommand { const editFocusedSettingCommand2 = new EditFocusedSettingCommand2({ id: SETTINGS_EDITOR_COMMAND_EDIT_FOCUSED_SETTING, precondition: ContextKeyExpr.and(CONTEXT_SETTINGS_EDITOR, CONTEXT_SETTINGS_ROW_FOCUS), - kbOpts: { primary: KeyCode.Enter } + kbOpts: { primary: KeyCode.Enter, weight: KeybindingsRegistry.WEIGHT.workbenchContrib() } }); -editFocusedSettingCommand2.register(KeybindingsRegistry.WEIGHT.workbenchContrib()); +editFocusedSettingCommand2.register(); class FocusSettingsListCommand extends SettingsCommand { @@ -491,9 +491,9 @@ class FocusSettingsListCommand extends SettingsCommand { const focusSettingsListCommand = new FocusSettingsListCommand({ id: SETTINGS_EDITOR_COMMAND_FOCUS_SETTINGS_LIST, precondition: ContextKeyExpr.and(CONTEXT_SETTINGS_EDITOR, CONTEXT_TOC_ROW_FOCUS), - kbOpts: { primary: KeyCode.Enter } + kbOpts: { primary: KeyCode.Enter, weight: KeybindingsRegistry.WEIGHT.workbenchContrib() } }); -focusSettingsListCommand.register(KeybindingsRegistry.WEIGHT.workbenchContrib()); +focusSettingsListCommand.register(); // Preferences menu diff --git a/src/vs/workbench/parts/scm/electron-browser/dirtydiffDecorator.ts b/src/vs/workbench/parts/scm/electron-browser/dirtydiffDecorator.ts index 90a6893cdf4..e11e00143ae 100644 --- a/src/vs/workbench/parts/scm/electron-browser/dirtydiffDecorator.ts +++ b/src/vs/workbench/parts/scm/electron-browser/dirtydiffDecorator.ts @@ -372,7 +372,7 @@ export class ShowPreviousChangeAction extends EditorAction { label: nls.localize('show previous change', "Show Previous Change"), alias: 'Show Previous Change', precondition: null, - kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Shift | KeyMod.Alt | KeyCode.F3 } + kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Shift | KeyMod.Alt | KeyCode.F3, weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -406,7 +406,7 @@ export class ShowNextChangeAction extends EditorAction { label: nls.localize('show next change', "Show Next Change"), alias: 'Show Next Change', precondition: null, - kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Alt | KeyCode.F3 } + kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Alt | KeyCode.F3, weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -440,7 +440,7 @@ export class MoveToPreviousChangeAction extends EditorAction { label: nls.localize('move to previous change', "Move to Previous Change"), alias: 'Move to Previous Change', precondition: null, - kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Shift | KeyMod.Alt | KeyCode.F5 } + kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Shift | KeyMod.Alt | KeyCode.F5, weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } @@ -482,7 +482,7 @@ export class MoveToNextChangeAction extends EditorAction { label: nls.localize('move to next change', "Move to Next Change"), alias: 'Move to Next Change', precondition: null, - kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Alt | KeyCode.F5 } + kbOpts: { kbExpr: EditorContextKeys.editorTextFocus, primary: KeyMod.Alt | KeyCode.F5, weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); } diff --git a/src/vs/workbench/parts/webview/electron-browser/webview.contribution.ts b/src/vs/workbench/parts/webview/electron-browser/webview.contribution.ts index 2dbb4818b37..b1d86248aec 100644 --- a/src/vs/workbench/parts/webview/electron-browser/webview.contribution.ts +++ b/src/vs/workbench/parts/webview/electron-browser/webview.contribution.ts @@ -42,10 +42,11 @@ const showNextFindWdigetCommand = new ShowWebViewEditorFindWidgetCommand({ id: ShowWebViewEditorFindWidgetCommand.ID, precondition: KEYBINDING_CONTEXT_WEBVIEWEDITOR_FOCUS, kbOpts: { - primary: KeyMod.CtrlCmd | KeyCode.KEY_F + primary: KeyMod.CtrlCmd | KeyCode.KEY_F, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); -showNextFindWdigetCommand.register(KeybindingsRegistry.WEIGHT.editorContrib()); +showNextFindWdigetCommand.register(); const hideCommand = new HideWebViewEditorFindCommand({ id: HideWebViewEditorFindCommand.ID, @@ -53,19 +54,21 @@ const hideCommand = new HideWebViewEditorFindCommand({ KEYBINDING_CONTEXT_WEBVIEWEDITOR_FOCUS, KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE), kbOpts: { - primary: KeyCode.Escape + primary: KeyCode.Escape, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); -hideCommand.register(KeybindingsRegistry.WEIGHT.editorContrib()); +hideCommand.register(); const selectAllCommand = new SelectAllWebviewEditorCommand({ id: SelectAllWebviewEditorCommand.ID, precondition: KEYBINDING_CONTEXT_WEBVIEWEDITOR_FOCUS, kbOpts: { - primary: KeyMod.CtrlCmd | KeyCode.KEY_A + primary: KeyMod.CtrlCmd | KeyCode.KEY_A, + weight: KeybindingsRegistry.WEIGHT.editorContrib() } }); -selectAllCommand.register(KeybindingsRegistry.WEIGHT.editorContrib()); +selectAllCommand.register(); actionRegistry.registerWorkbenchAction( new SyncActionDescriptor(OpenWebviewDeveloperToolsAction, OpenWebviewDeveloperToolsAction.ID, OpenWebviewDeveloperToolsAction.LABEL), -- GitLab