From cf5493959b952ff7ae0be4c88f53c241ba4cc178 Mon Sep 17 00:00:00 2001 From: l0ng-ai Date: Sat, 5 Dec 2026 02:14:45 +0800 Subject: [PATCH] feat(keymap): add Visual Studio and ReSharper keymap presets (#8106) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Settings › Keymap gains Visual Studio and ReSharper presets for Windows/Linux and macOS, generated from JetBrains' Visual Studio and ReSharper keymaps with the same parent chain (Visual Studio on the OS's IntelliJ preset, ReSharper on Visual Studio). Inherited bindings of context-free actions are dropped where a preset gives their key to another action. IDEA_ACTIONS gains 64 standard IDEA action ids, which also helps imported IDEA keymaps and IdeaVim's :action, and imported keymaps based on Visual Studio, ReSharper or NetBeans pick that preset as their parent. --- src/platform/ideaActions.ts | 64 +++++++ src/platform/ideaKeymap.ts | 7 +- src/platform/keymap.ts | 12 ++ src/platform/keymaps/resharper-macos.ts | 67 ++++++++ src/platform/keymaps/resharper-windows.ts | 75 ++++++++ src/platform/keymaps/visualStudio.test.ts | 67 ++++++++ src/platform/keymaps/visualstudio-macos.ts | 148 ++++++++++++++++ src/platform/keymaps/visualstudio-windows.ts | 170 +++++++++++++++++++ 8 files changed, 608 insertions(+), 2 deletions(-) create mode 100644 src/platform/keymaps/resharper-macos.ts create mode 100644 src/platform/keymaps/resharper-windows.ts create mode 100644 src/platform/keymaps/visualStudio.test.ts create mode 100644 src/platform/keymaps/visualstudio-macos.ts create mode 100644 src/platform/keymaps/visualstudio-windows.ts diff --git a/src/platform/ideaActions.ts b/src/platform/ideaActions.ts index 7e3a8867e4..3a9e8879f4 100644 --- a/src/platform/ideaActions.ts +++ b/src/platform/ideaActions.ts @@ -220,4 +220,68 @@ export const IDEA_ACTIONS: Readonly> = { "Vcs.Log.MaximizeCommitMessage": "vcs.log.maximizeCommitMessage", "Vcs.Log.Refresh": "vcs.log.refresh", "Vcs.Log.FocusTextFilter": "vcs.log.focusTextFilter", + Resume: "debug.resume", + StepOver: "debug.stepOver", + StepInto: "debug.stepInto", + StepOut: "debug.stepOut", + ForceStepInto: "debug.forceStepInto", + RunToCursor: "debug.runToCursor", + ShowExecutionPoint: "debug.showExecutionPoint", + EvaluateExpression: "debug.evaluate", + ViewBreakpoints: "debug.viewBreakpoints", + "XDebugger.AttachToProcess": "debug.attachToProcess", + FindNext: "find.next", + FindPrevious: "find.previous", + CompileDirty: "build.buildProject", + Compile: "build.compileFile", + RestoreDefaultLayout: "layout.restoreCurrent", + EditorMatchBrace: "editor.matchBrace", + EditorScrollToCenter: "editor.scrollToCenter", + EditorCodeBlockStart: "editor.codeBlockStart", + EditorCodeBlockEnd: "editor.codeBlockEnd", + EditorCodeBlockStartWithSelection: "editor.codeBlockStartWithSelection", + EditorCodeBlockEndWithSelection: "editor.codeBlockEndWithSelection", + EditorAddOrRemoveCaret: "editor.addOrRemoveCaret", + InsertLiveTemplate: "code.insertLiveTemplate", + SurroundWithLiveTemplate: "code.surroundWithLiveTemplate", + ImplementMethods: "code.implementMethods", + OverrideMethods: "code.overrideMethods", + ExpressionTypeInfo: "code.expressionTypeInfo", + ShowErrorDescription: "code.showErrorDescription", + HippieCompletion: "code.cyclicExpandWord", + HippieBackwardCompletion: "code.cyclicExpandWordBackward", + NextOccurence: "navigate.nextOccurrence", + PreviousOccurence: "navigate.prevOccurrence", + MoveLineUp: "code.moveLineUp", + MoveLineDown: "code.moveLineDown", + MoveStatementUp: "code.moveStatementUp", + MoveStatementDown: "code.moveStatementDown", + SelectNextOccurrence: "code.addCaretNextOccurrence", + SelectAllOccurrences: "code.selectAllOccurrences", + UnselectPreviousOccurrence: "code.unselectOccurrence", + EditorStartNewLine: "code.startNewLine", + EditorStartNewLineBefore: "code.startNewLineBefore", + EditorSplitLine: "code.splitLine", + ToggleFullScreen: "window.toggleFullScreen", + ShowNavBar: "navigate.navigationBar", + JumpToLastChange: "navigate.lastEditLocation", + ZoomInIdeAction: "view.zoomIn", + ZoomOutIdeAction: "view.zoomOut", + QuickChangeScheme: "view.quickSwitchScheme", + "Git.Commit.And.Push.Executor": "vcs.commitAndPush", + ActivateTerminalToolWindow: "toolwindow.terminal", + ActivateStructureToolWindow: "toolwindow.structure", + ActivateFindToolWindow: "toolwindow.find", + ActivateServicesToolWindow: "toolwindow.services", + ActivateCommitToolWindow: "toolwindow.commit", + RecentChanges: "localHistory.recentChanges", + SwitchHeaderSource: "navigate.headerSource", + Pause: "debug.pause", + GotoNextBookmark: "navigate.nextBookmark", + GotoPreviousBookmark: "navigate.prevBookmark", + OpenFile: "file.openFile", + CodeCleanup: "code.cleanup", + "Vcs.ShowMessageHistory": "vcs.showMessageHistory", + ActivateBuildToolWindow: "toolwindow.build", + ActivateDatabaseToolWindow: "toolwindow.database", }; diff --git a/src/platform/ideaKeymap.ts b/src/platform/ideaKeymap.ts index 3a07f22df7..063fdc206a 100644 --- a/src/platform/ideaKeymap.ts +++ b/src/platform/ideaKeymap.ts @@ -31,10 +31,13 @@ export interface ImportedIdeaKeymap { /** IDEA's bundled keymap names (``) → our presets. */ function presetOf(parent: string | null): string { const p = parent ?? ""; - // "Mac OS X 10.5+", "Eclipse (Mac OS X)", "VSCode (macOS)"; not the "mac" inside "Emacs". - const mac = /\bmac(?: ?os)?\b/i.test(p); + // "Mac OS X 10.5+", "Eclipse (Mac OS X)", "VSCode (macOS)", "Visual Studio OSX"; not the "mac" inside "Emacs". + const mac = /\bmac(?: ?os)?\b|\bosx\b/i.test(p); if (/^eclipse/i.test(p)) return mac ? "eclipse-macos" : "eclipse-windows"; if (/^vs ?code/i.test(p)) return mac ? "vscode-macos" : "vscode-windows"; + if (/^netbeans/i.test(p)) return mac ? "netbeans-macos" : "netbeans-windows"; + if (/^visual studio/i.test(p)) return mac ? "visualstudio-macos" : "visualstudio-windows"; + if (/^resharper/i.test(p)) return mac ? "resharper-macos" : "resharper-windows"; if (mac) return "intellij-macos"; // IDEA's Emacs keymap (and copies of it) inherits $default. if (p === "$default" || /^default for/i.test(p) || /^emacs\b/i.test(p)) return "intellij-windows"; diff --git a/src/platform/keymap.ts b/src/platform/keymap.ts index 17bf5538a5..05add0fbf5 100644 --- a/src/platform/keymap.ts +++ b/src/platform/keymap.ts @@ -23,6 +23,10 @@ import { eclipseMacos } from "./keymaps/eclipse-macos"; import { eclipseWindows } from "./keymaps/eclipse-windows"; import { netbeansMacos } from "./keymaps/netbeans-macos"; import { netbeansWindows } from "./keymaps/netbeans-windows"; +import { visualStudioMacos } from "./keymaps/visualstudio-macos"; +import { visualStudioWindows } from "./keymaps/visualstudio-windows"; +import { resharperMacos } from "./keymaps/resharper-macos"; +import { resharperWindows } from "./keymaps/resharper-windows"; import { usePlatform } from "./platformInfo"; import { tx } from "./i18n"; import { isImeKey } from "./ime"; @@ -47,6 +51,10 @@ export const PRESETS: Record = { "eclipse-windows": eclipseWindows, "netbeans-macos": netbeansMacos, "netbeans-windows": netbeansWindows, + "visualstudio-macos": visualStudioMacos, + "visualstudio-windows": visualStudioWindows, + "resharper-macos": resharperMacos, + "resharper-windows": resharperWindows, }; /** Display names of the presets, in menu order. */ @@ -59,6 +67,10 @@ export const PRESET_TITLES: Record = { "eclipse-windows": "Eclipse", "netbeans-macos": "NetBeans (macOS)", "netbeans-windows": "NetBeans", + "visualstudio-macos": "Visual Studio (macOS)", + "visualstudio-windows": "Visual Studio", + "resharper-macos": "ReSharper (macOS)", + "resharper-windows": "ReSharper", }; /** ⌘ held on macOS, Ctrl elsewhere: the modifier of ⌘/Ctrl-click and copy/paste. */ diff --git a/src/platform/keymaps/resharper-macos.ts b/src/platform/keymaps/resharper-macos.ts new file mode 100644 index 0000000000..b7c56b9a4e --- /dev/null +++ b/src/platform/keymaps/resharper-macos.ts @@ -0,0 +1,67 @@ +/** + * ReSharper preset for macOS, matching IDEA's and Rider's "ReSharper OSX" keymap, which builds on + * the Visual Studio OSX one. + * Source: JetBrains `resharper-keymap/resources/keymaps/ReSharper OSX.xml` (plugins/keymaps in intellij-community). + * IDEA action ids are translated by `IDEA_ACTIONS`; actions without an OpenIDEA counterpart keep + * the parent's keys. + */ +import { visualStudioMacos } from "./visualstudio-macos"; + +export const resharperMacos: Record = { + ...visualStudioMacos, + "code.cleanup": ["Alt+Meta+F"], + "code.commentLine": ["Meta+/", "Meta+NumpadDivide"], + "code.completion": ["Ctrl+Space"], + "code.extendSelection": ["Alt+Up"], + "code.generate": ["Ctrl+Meta+N", "Alt+Insert"], + "code.insertLiveTemplate": ["Meta+J"], + "code.quickDocumentation": ["Ctrl+Q"], + "code.reformat": ["Alt+Meta+L"], + "code.shrinkSelection": ["Alt+Down"], + "code.smartTypeCompletion": ["Ctrl+Shift+Space"], + "code.surroundWithLiveTemplate": ["Alt+Meta+J"], + "debug.attachToProcess": ["Ctrl+Alt+F5"], + "debug.viewBreakpoints": ["Shift+Meta+F8"], + "editor.toggleLocalWhitespaces": [], + "find.highlightUsages": ["Shift+Meta+F7"], + "find.showUsages": ["Alt+Meta+F7"], + "find.usages": ["Alt+F7"], + "navigate.callHierarchy": [], + "navigate.declaration": ["Meta+B"], + "navigate.fileStructure": ["Meta+F12"], + "navigate.gotoFile": ["Shift+Meta+N"], + "navigate.gotoSymbol": ["Alt+Shift+Meta+N"], + "navigate.headerSource": ["Ctrl+Meta+O"], + "navigate.implementation": ["Alt+Meta+B", "Alt+Meta+Button1"], + "navigate.lastEditLocation": ["Shift+Meta+Backspace"], + "navigate.navigationBar": ["Ctrl+Alt+Left", "Alt+Home"], + "navigate.nextBookmark": [], + "navigate.prevBookmark": [], + "navigate.prevError": ["Shift+F12"], + "navigate.recentFiles": ["Meta+E"], + "navigate.relatedSymbol": ["Alt+Shift+Meta+G"], + "navigate.searchEverywhere": ["Meta+N"], + "navigate.showBookmarks": ["Ctrl+`"], + "navigate.superMethod": ["Meta+U"], + "navigate.toggleBookmark": [], + "navigate.typeDeclaration": ["Shift+Meta+T"], + "navigate.typeHierarchy": ["Alt+Meta+H"], + "refactor.changeSignature": ["Meta+F6"], + "refactor.extractField": ["Alt+Meta+D"], + "refactor.extractMethod": ["Alt+Meta+M"], + "refactor.extractParameter": ["Alt+Meta+P"], + "refactor.extractVariable": ["Alt+Meta+V"], + "refactor.inline": ["Alt+Meta+N"], + "refactor.move": ["F6"], + "refactor.rename": ["F2"], + "refactor.safeDelete": ["Alt+Delete"], + "refactor.thisMenu": ["Shift+Meta+R"], + "toolwindow.find": ["Meta+3", "Alt+Meta+U"], + "toolwindow.project": ["Meta+1"], + "toolwindow.structure": ["Ctrl+F11"], + "vcs.commit": ["Meta+K"], + "vcs.nextChange": [], + "vcs.prevChange": [], + // Inherited keys this keymap gives to other actions. + "services.addService": [], +}; diff --git a/src/platform/keymaps/resharper-windows.ts b/src/platform/keymaps/resharper-windows.ts new file mode 100644 index 0000000000..3e5ee7513a --- /dev/null +++ b/src/platform/keymaps/resharper-windows.ts @@ -0,0 +1,75 @@ +/** + * ReSharper preset for Windows and Linux, matching IDEA's and Rider's "ReSharper" keymap, which + * builds on the Visual Studio one. + * Source: JetBrains `resharper-keymap/resources/keymaps/ReSharper.xml` (plugins/keymaps in intellij-community). + * IDEA action ids are translated by `IDEA_ACTIONS`; actions without an OpenIDEA counterpart keep + * the parent's keys. + */ +import { visualStudioWindows } from "./visualstudio-windows"; + +export const resharperWindows: Record = { + ...visualStudioWindows, + "code.cleanup": ["Ctrl+Alt+F"], + "code.commentBlock": ["Ctrl+Shift+/", "Ctrl+Shift+NumpadDivide"], + "code.commentLine": ["Ctrl+/", "Ctrl+NumpadDivide"], + "code.completion": ["Ctrl+Space"], + "code.extendSelection": ["Ctrl+W"], + "code.implementMethods": ["Ctrl+I"], + "code.insertLiveTemplate": ["Ctrl+J"], + "code.parameterInfo": ["Ctrl+P"], + "code.quickDefinition": ["Ctrl+Shift+I"], + "code.quickDocumentation": ["Ctrl+Q"], + "code.reformat": ["Ctrl+Alt+L"], + "code.shrinkSelection": ["Ctrl+Shift+W"], + "code.smartTypeCompletion": ["Ctrl+Shift+Space"], + "code.startNewLine": ["Shift+Enter"], + "code.surroundWithLiveTemplate": ["Ctrl+Alt+J"], + "debug.attachToProcess": ["Ctrl+Alt+F5"], + "debug.viewBreakpoints": ["Ctrl+Shift+F8"], + "editor.toggleLocalWhitespaces": [], + "find.highlightUsages": ["Ctrl+Shift+F7"], + "find.showUsages": ["Ctrl+Alt+F7"], + "find.usages": ["Alt+F7"], + "navigate.callHierarchy": [], + "navigate.declaration": ["Ctrl+B"], + "navigate.fileStructure": ["Ctrl+F12"], + "navigate.gotoFile": ["Ctrl+Shift+N"], + "navigate.gotoSymbol": ["Ctrl+Alt+Shift+N"], + "navigate.headerSource": ["Alt+O"], + "navigate.implementation": ["Ctrl+Alt+B"], + "navigate.navigationBar": ["Alt+Home"], + "navigate.nextBookmark": [], + "navigate.nextError": ["F12"], + "navigate.prevBookmark": [], + "navigate.prevError": ["Shift+F12"], + "navigate.recentFiles": ["Ctrl+E"], + "navigate.recentLocations": [], + "navigate.relatedSymbol": ["Ctrl+Alt+Shift+G"], + "navigate.searchEverywhere": ["Ctrl+N"], + "navigate.showBookmarks": ["Ctrl+`"], + "navigate.superMethod": ["Ctrl+U"], + "navigate.toggleBookmark": [], + "navigate.typeDeclaration": ["Ctrl+Shift+T"], + "navigate.typeHierarchy": ["Ctrl+Alt+H"], + "refactor.changeSignature": ["Ctrl+F6"], + "refactor.extractField": ["Ctrl+Alt+D"], + "refactor.extractMethod": ["Ctrl+Alt+M"], + "refactor.extractParameter": ["Ctrl+Alt+P"], + "refactor.extractVariable": ["Ctrl+Alt+V"], + "refactor.inline": ["Ctrl+Alt+N"], + "refactor.move": ["F6"], + "refactor.rename": ["F2"], + "refactor.safeDelete": ["Alt+Delete"], + "toolwindow.find": ["Alt+3", "Ctrl+Alt+U"], + "toolwindow.jumpToLast": ["Ctrl+Alt+Backspace", "Alt+Shift+F6"], + "toolwindow.project": ["Alt+1"], + "toolwindow.structure": ["Ctrl+F11"], + "vcs.commit": ["Ctrl+K"], + "vcs.nextChange": [], + "vcs.operations": ["Alt+`"], + "vcs.prevChange": [], + // Inherited keys this keymap gives to other actions. + "navigate.toggleBookmarkWithMnemonic": [], + "vcs.newBranch": [], + "vcs.unshelveSilently": [], +}; diff --git a/src/platform/keymaps/visualStudio.test.ts b/src/platform/keymaps/visualStudio.test.ts new file mode 100644 index 0000000000..42f7502cb9 --- /dev/null +++ b/src/platform/keymaps/visualStudio.test.ts @@ -0,0 +1,67 @@ +import { describe, expect, it } from "vitest"; +import { parseIdeaKeymap } from "../ideaKeymap"; +import { PRESETS, PRESET_TITLES } from "../keymap"; +import { resharperMacos } from "./resharper-macos"; +import { resharperWindows } from "./resharper-windows"; +import { visualStudioMacos } from "./visualstudio-macos"; +import { visualStudioWindows } from "./visualstudio-windows"; + +/** Actions bound to `key` in `keymap`. */ +const owners = (keymap: Record, key: string) => + Object.entries(keymap) + .filter(([, keys]) => keys.includes(key)) + .map(([id]) => id) + .sort(); + +describe("Visual Studio and ReSharper keymaps", () => { + it("are available as presets", () => { + expect(PRESETS["visualstudio-windows"]).toBe(visualStudioWindows); + expect(PRESETS["resharper-windows"]).toBe(resharperWindows); + expect(PRESETS["visualstudio-macos"]).toBe(visualStudioMacos); + expect(PRESETS["resharper-macos"]).toBe(resharperMacos); + expect(PRESET_TITLES["visualstudio-windows"]).toBe("Visual Studio"); + expect(PRESET_TITLES["resharper-windows"]).toBe("ReSharper"); + }); + + it("use Visual Studio's debugger and navigation keys", () => { + expect(visualStudioWindows["debug.resume"]).toEqual(["F5"]); + expect(visualStudioWindows["debug.stepOver"]).toEqual(["F10"]); + expect(visualStudioWindows["debug.stepInto"]).toEqual(["F11"]); + expect(visualStudioWindows["build.buildProject"]).toEqual(["F7"]); + expect(visualStudioWindows["navigate.declaration"]).toEqual(["F12"]); + expect(visualStudioWindows["find.usages"]).toEqual(["Shift+F12"]); + // F9 toggles a breakpoint; Resume moved to F5 instead of keeping IDEA's F9. + expect(owners(visualStudioWindows, "F9")).toEqual(["debug.toggleBreakpoint"]); + }); + + it("layer ReSharper's keys over Visual Studio's", () => { + expect(visualStudioWindows["refactor.rename"]).toEqual(["Ctrl+R R", "Ctrl+R Ctrl+R"]); + expect(resharperWindows["refactor.rename"]).toEqual(["F2"]); + expect(resharperWindows["code.showIntentions"]).toContain("Alt+Enter"); + expect(resharperWindows["navigate.declaration"]).toEqual(["Ctrl+B"]); + // Inherited from Visual Studio. + expect(resharperWindows["debug.stepOver"]).toEqual(["F10"]); + }); + + it("take a key from an inherited action that has no context of its own", () => { + // Ctrl+. shows context actions, so it no longer folds the selection. + expect(owners(visualStudioWindows, "Ctrl+.")).toEqual(["code.showIntentions"]); + // Ctrl+Shift+H is Replace in Files, not Shelve Silently. + expect(owners(resharperWindows, "Ctrl+Shift+H")).toEqual(["find.replaceInPath"]); + expect(owners(visualStudioMacos, "F10")).toEqual(["debug.stepOver"]); + }); + + it("keep the trackpad swipes for history on macOS", () => { + expect(visualStudioMacos["navigate.back"]).toContain("SwipeRight"); + expect(resharperMacos["navigate.forward"]).toContain("SwipeLeft"); + }); + + it("are the parents of imported IDEA keymaps based on them", () => { + const parent = (name: string) => parseIdeaKeymap(``).parent; + expect(parent("Visual Studio")).toBe("visualstudio-windows"); + expect(parent("Visual Studio OSX")).toBe("visualstudio-macos"); + expect(parent("ReSharper")).toBe("resharper-windows"); + expect(parent("ReSharper OSX")).toBe("resharper-macos"); + expect(parent("NetBeans 6.5")).toBe("netbeans-windows"); + }); +}); diff --git a/src/platform/keymaps/visualstudio-macos.ts b/src/platform/keymaps/visualstudio-macos.ts new file mode 100644 index 0000000000..a5ea4843e6 --- /dev/null +++ b/src/platform/keymaps/visualstudio-macos.ts @@ -0,0 +1,148 @@ +/** + * Visual Studio preset for macOS, matching IDEA's and Rider's "Visual Studio OSX" keymap. + * Source: JetBrains `visual-studio-keymap/resources/keymaps/Visual Studio OSX.xml` (plugins/keymaps in intellij-community). + * IDEA action ids are translated by `IDEA_ACTIONS`; actions without an OpenIDEA counterpart keep + * the parent's keys. + */ +import { intellijMacos } from "./intellij-macos"; + +export const visualStudioMacos: Record = { + ...intellijMacos, + "build.buildProject": ["F7"], + "build.compileFile": ["Meta+F7"], + "code.addCaretNextOccurrence": ["Alt+Shift+."], + "code.cleanup": ["Meta+E C", "Meta+E Meta+C"], + "code.commentBlock": ["Ctrl+Meta+/", "Shift+Meta+NumpadDivide"], + "code.commentLine": [ + "Alt+Meta+/", + "Alt+Meta+NumpadDivide", + "Meta+K C", + "Meta+K Meta+C", + "Meta+K Meta+/", + "Meta+K Meta+U", + ], + "code.completion": ["Ctrl+Space", "Ctrl+J"], + "code.deleteLine": ["Shift+Meta+L"], + "code.expressionTypeInfo": [], + "code.extendSelection": ["Alt+Meta+Right"], + "code.fold": ["Ctrl+M S", "Ctrl+M Ctrl+S"], + "code.foldAll": ["Ctrl+M A", "Ctrl+M Ctrl+A"], + "code.generate": ["Ctrl+Meta+N"], + "code.implementMethods": ["Ctrl+I"], + "code.insertLiveTemplate": ["Meta+E L", "Meta+E Meta+L"], + "code.moveLineDown": [], + "code.moveLineUp": [], + "code.moveStatementDown": ["Ctrl+Alt+Shift+Down"], + "code.moveStatementUp": ["Ctrl+Alt+Shift+Up"], + "code.overrideMethods": [], + "code.quickDocumentation": ["Meta+K I", "Meta+K Meta+I", "Ctrl+Shift+F1"], + "code.reformat": ["Alt+Meta+Enter", "Meta+K F", "Meta+K Meta+F", "Meta+K D", "Meta+K Meta+D"], + "code.selectAllOccurrences": ["Alt+Shift+;"], + "code.showErrorDescription": [], + "code.shrinkSelection": ["Alt+Meta+Left"], + "code.smartTypeCompletion": ["Alt+Shift+Space", "Ctrl+Alt+Space"], + "code.splitLine": [], + "code.startNewLineBefore": ["Meta+Enter"], + "code.surroundWith": [], + "code.surroundWithLiveTemplate": ["Meta+E U", "Meta+E Meta+U"], + "code.unfold": ["Ctrl+M E", "Ctrl+M Ctrl+E"], + "code.unfoldAll": ["Ctrl+M X", "Ctrl+M Ctrl+X"], + "code.unselectOccurrence": ["Alt+Shift+,"], + "debug.attachToProcess": ["Alt+Meta+P"], + "debug.evaluate": ["Shift+F9"], + "debug.forceStepInto": ["Alt+F11"], + "debug.pause": ["Shift+Meta+P"], + "debug.resume": ["F5"], + "debug.runToCursor": ["Meta+F10"], + "debug.showExecutionPoint": ["Alt+NumpadMultiply"], + "debug.stepInto": ["Meta+F11", "F11"], + "debug.stepOut": ["Shift+F11"], + "debug.stepOver": ["F10"], + "debug.toggleBreakpoint": ["F9"], + "debug.toggleBreakpointEnabled": ["Meta+F9"], + "debug.viewBreakpoints": ["Alt+Meta+B"], + "editor.closeTab": ["Meta+F4"], + "editor.leftWithSelection": ["Shift+Left", "Ctrl+Shift+Left"], + "editor.matchBrace": ["Meta+]"], + "editor.moveToPageBottomWithSelection": ["Shift+Meta+Down"], + "editor.moveToPageTopWithSelection": ["Shift+Meta+Up"], + "editor.rightWithSelection": ["Shift+Right", "Ctrl+Shift+Right"], + "editor.toggleLocalWhitespaces": ["Meta+R W", "Meta+R Meta+W"], + "file.openFile": ["Meta+O"], + "file.save": ["Shift+Meta+S"], + "file.saveAs": [], + "find.highlightUsages": ["Alt+Shift+F11"], + "find.next": ["F3", "Alt+Meta+PageDown"], + "find.previous": ["Shift+F3", "Alt+Meta+PageUp"], + "find.previousWordAtCaret": ["Shift+Meta+F3"], + "find.replaceInFile": ["Ctrl+H"], + "find.replaceInPath": ["Shift+Meta+H"], + "find.showUsages": ["Alt+Shift+F12"], + "find.usages": ["Shift+F12"], + "find.wordAtCaret": ["Meta+F3"], + "layout.restoreCurrent": [], + "localHistory.recentChanges": [], + "navigate.back": ["Meta+-", "Meta+NumpadSubtract", "Button4", "SwipeRight"], + "navigate.declaration": ["F12"], + "navigate.fileStructure": ["Alt+\\"], + "navigate.forward": ["Shift+Meta+-", "Shift+Meta+NumpadSubtract", "Button5", "SwipeLeft"], + "navigate.gotoClass": [], + "navigate.gotoFile": ["Shift+Meta+T"], + "navigate.gotoLine": ["Meta+G"], + "navigate.gotoSymbol": ["Alt+Shift+Meta+T"], + "navigate.gotoTest": [], + "navigate.headerSource": ["Ctrl+Meta+O", "Meta+K O", "Meta+K Meta+O"], + "navigate.implementation": ["Alt+Meta+Button1", "Alt+End"], + "navigate.lastEditLocation": ["Shift+Meta+Backspace"], + "navigate.navigationBar": ["Meta+F2"], + "navigate.nextBookmark": ["Meta+K N", "Meta+K Meta+N"], + "navigate.nextError": ["Alt+PageDown"], + "navigate.prevBookmark": ["Meta+K P", "Meta+K Meta+P"], + "navigate.prevError": ["Alt+PageUp"], + "navigate.recentFiles": ["Ctrl+,"], + "navigate.recentLocations": [], + "navigate.relatedSymbol": ["Shift+Meta+F7"], + "navigate.searchEverywhere": ["Meta+T"], + "navigate.showBookmarks": ["Ctrl+`", "Meta+K W", "Meta+K Meta+W"], + "navigate.superMethod": ["Ctrl+Alt+Left", "Alt+Home"], + "navigate.toggleBookmark": ["Meta+F2", "Meta+K K", "Meta+K Meta+K"], + "navigate.typeDeclaration": ["Shift+Meta+F11"], + "navigate.typeHierarchy": ["Meta+E H", "Meta+E Meta+H"], + "refactor.changeSignature": ["Meta+R S", "Meta+R Meta+S"], + "refactor.extractField": ["Meta+R F", "Meta+R Meta+F"], + "refactor.extractMethod": ["Meta+R M", "Meta+R Meta+M"], + "refactor.extractParameter": ["Meta+R P", "Meta+R Meta+P"], + "refactor.extractVariable": ["Meta+R V", "Meta+R Meta+V"], + "refactor.inline": ["Meta+R I", "Meta+R Meta+I"], + "refactor.move": ["Meta+R O", "Meta+R Meta+O"], + "refactor.rename": ["Meta+R R", "Meta+R Meta+R"], + "refactor.safeDelete": ["Meta+R D", "Meta+R Meta+D", "Alt+Delete"], + "refactor.thisMenu": ["Shift+Meta+R"], + "run.chooseConfig": ["Alt+Shift+Meta+R"], + "run.debug": ["Alt+F5"], + "run.rerun": ["Alt+Shift+F5"], + "run.run": ["Ctrl+F5"], + "run.runContext": ["Ctrl+Alt+F5"], + "run.stop": ["Shift+F5"], + "toolwindow.build": ["Meta+0"], + "toolwindow.commit": [], + "toolwindow.database": ["Ctrl+Meta+3"], + "toolwindow.find": ["Meta+3", "Alt+Meta+F12"], + "toolwindow.jumpToLast": ["Alt+Shift+F6"], + "toolwindow.project": ["Alt+Meta+L", "Meta+1"], + "toolwindow.services": [], + "toolwindow.structure": ["Alt+Meta+F", "Ctrl+Alt+F"], + "toolwindow.terminal": ["Ctrl+Meta+1"], + "vcs.commit": ["Alt+Shift+Meta+K"], + "vcs.nextChange": ["Alt+Shift+Meta+N"], + "vcs.prevChange": ["Alt+Shift+Meta+P"], + "vcs.showMessageHistory": ["Ctrl+H"], + "vcs.update": ["Alt+Meta+W"], + "view.quickSwitchScheme": [], + "window.toggleFullScreen": ["Alt+Shift+Enter"], + // Inherited keys this keymap gives to other actions. + "code.applyQuickFix": [], + "editor.inlineCompletion.trigger": [], + "run.updateApplication": [], + "toolwindow.resizeLeft": [], +}; diff --git a/src/platform/keymaps/visualstudio-windows.ts b/src/platform/keymaps/visualstudio-windows.ts new file mode 100644 index 0000000000..9174c995e1 --- /dev/null +++ b/src/platform/keymaps/visualstudio-windows.ts @@ -0,0 +1,170 @@ +/** + * Visual Studio preset for Windows and Linux, matching IDEA's and Rider's "Visual Studio" keymap. + * Source: JetBrains `visual-studio-keymap/resources/keymaps/Visual Studio.xml` (plugins/keymaps in intellij-community). + * IDEA action ids are translated by `IDEA_ACTIONS`; actions without an OpenIDEA counterpart keep + * the parent's keys. + */ +import { intellijWindows } from "./intellij-windows"; + +export const visualStudioWindows: Record = { + ...intellijWindows, + "build.buildProject": ["F7"], + "build.compileFile": ["Ctrl+F7"], + "code.addCaretNextOccurrence": ["Alt+Shift+."], + "code.cleanup": ["Ctrl+E C", "Ctrl+E Ctrl+C"], + "code.commentLine": [ + "Ctrl+Alt+/", + "Ctrl+Alt+NumpadDivide", + "Ctrl+K C", + "Ctrl+K Ctrl+C", + "Ctrl+K Ctrl+/", + "Ctrl+K Ctrl+U", + ], + "code.completion": ["Ctrl+Space", "Ctrl+J"], + "code.cyclicExpandWordBackward": [], + "code.deleteLine": ["Ctrl+L", "Ctrl+Shift+L"], + "code.expressionTypeInfo": [], + "code.extendSelection": ["Alt+Shift+=", "Ctrl+Alt+Right", "Ctrl+W"], + "code.fold": ["Ctrl+M S", "Ctrl+M Ctrl+S"], + "code.foldAll": ["Ctrl+M A", "Ctrl+M Ctrl+A"], + "code.implementMethods": ["Ctrl+Shift+I"], + "code.insertLiveTemplate": ["Ctrl+K X", "Ctrl+K Ctrl+X", "Ctrl+E L", "Ctrl+E Ctrl+L"], + "code.moveLineDown": [], + "code.moveLineUp": [], + "code.moveStatementDown": ["Ctrl+Alt+Shift+Down"], + "code.moveStatementUp": ["Ctrl+Alt+Shift+Up"], + "code.optimizeImports": ["Ctrl+R G", "Ctrl+R Ctrl+G", "Ctrl+Alt+O"], + "code.overrideMethods": [], + "code.parameterInfo": ["Ctrl+Shift+Space"], + "code.quickDefinition": ["Alt+F12"], + "code.quickDocumentation": ["Ctrl+K I", "Ctrl+K Ctrl+I", "Ctrl+Shift+F1"], + "code.reformat": ["Ctrl+Alt+Enter", "Ctrl+K F", "Ctrl+K Ctrl+F", "Ctrl+K D", "Ctrl+K Ctrl+D"], + "code.selectAllOccurrences": ["Alt+Shift+;"], + "code.showErrorDescription": [], + "code.showIntentions": ["Alt+Enter", "Ctrl+.", "Alt+Shift+F10"], + "code.shrinkSelection": ["Alt+Shift+-", "Ctrl+Alt+Left", "Ctrl+Shift+W"], + "code.smartTypeCompletion": ["Ctrl+Alt+Space"], + "code.splitLine": [], + "code.startNewLineBefore": ["Ctrl+Enter"], + "code.surroundWith": [], + "code.surroundWithLiveTemplate": ["Ctrl+E U", "Ctrl+E Ctrl+U", "Ctrl+K S", "Ctrl+K Ctrl+S"], + "code.unfold": ["Ctrl+M E", "Ctrl+M Ctrl+E"], + "code.unfoldAll": ["Ctrl+M X", "Ctrl+M Ctrl+X"], + "code.unselectOccurrence": ["Alt+Shift+,"], + "debug.attachToProcess": ["Ctrl+Alt+P"], + "debug.evaluate": ["Shift+F9"], + "debug.forceStepInto": ["Alt+F11"], + "debug.pause": ["Ctrl+Shift+P"], + "debug.resume": ["F5"], + "debug.runToCursor": ["Ctrl+F10"], + "debug.showExecutionPoint": ["Alt+NumpadMultiply"], + "debug.stepInto": ["F11"], + "debug.stepOut": ["Shift+F11"], + "debug.stepOver": ["F10"], + "debug.toggleBreakpoint": ["F9"], + "debug.toggleBreakpointEnabled": ["Ctrl+F9"], + "debug.viewBreakpoints": ["Ctrl+Alt+B"], + "editor.addOrRemoveCaret": ["Ctrl+Alt+Button1"], + "editor.codeBlockEnd": [], + "editor.codeBlockEndWithSelection": ["Ctrl+Alt+Shift+]"], + "editor.codeBlockStart": ["Alt+Shift+["], + "editor.codeBlockStartWithSelection": ["Ctrl+Alt+Shift+["], + "editor.decreaseFontSizeAll": [], + "editor.increaseFontSizeAll": [], + "editor.leftWithSelection": ["Shift+Left", "Alt+Shift+Left"], + "editor.matchBrace": ["Ctrl+]"], + "editor.nextTab": ["Alt+Right"], + "editor.prevTab": ["Alt+Left"], + "editor.rightWithSelection": ["Shift+Right", "Alt+Shift+Right"], + "editor.scrollToCenter": ["Ctrl+M C", "Ctrl+M Ctrl+C"], + "editor.toggleLocalWhitespaces": ["Ctrl+R W", "Ctrl+R Ctrl+W"], + "file.openFile": ["Ctrl+O"], + "file.save": ["Ctrl+Shift+S"], + "file.saveAs": [], + "find.highlightUsages": ["Alt+Shift+F11"], + "find.next": ["F3", "Ctrl+Alt+PageDown", "Alt+Shift+/"], + "find.previous": ["Shift+F3", "Ctrl+Alt+PageUp"], + "find.replaceInFile": ["Ctrl+H"], + "find.replaceInPath": ["Ctrl+Shift+H"], + "find.showUsages": ["Alt+Shift+F12"], + "find.usages": ["Shift+F12"], + "layout.restoreCurrent": [], + "localHistory.recentChanges": [], + "navigate.back": ["Ctrl+-", "Ctrl+NumpadSubtract", "Button4"], + "navigate.declaration": ["F12"], + "navigate.fileStructure": ["Alt+\\"], + "navigate.forward": ["Ctrl+Shift+-", "Ctrl+Shift+NumpadSubtract", "Button5"], + "navigate.gotoClass": [], + "navigate.gotoFile": ["Ctrl+Shift+T"], + "navigate.gotoLine": ["Ctrl+G"], + "navigate.gotoSymbol": ["Ctrl+Alt+Shift+T"], + "navigate.gotoTest": [], + "navigate.headerSource": ["Alt+O", "Ctrl+K O", "Ctrl+K Ctrl+O"], + "navigate.implementation": ["Alt+End"], + "navigate.lastEditLocation": ["Ctrl+Shift+Backspace"], + "navigate.navigationBar": ["Ctrl+F2"], + "navigate.nextBookmark": ["Ctrl+K N", "Ctrl+K Ctrl+N"], + "navigate.nextError": ["Alt+PageDown"], + "navigate.nextOccurrence": ["Ctrl+Alt+Down", "F8"], + "navigate.prevBookmark": ["Ctrl+K P", "Ctrl+K Ctrl+P"], + "navigate.prevError": ["Alt+PageUp"], + "navigate.prevOccurrence": ["Ctrl+Alt+Up", "Shift+F8"], + "navigate.recentFiles": ["Ctrl+,"], + "navigate.relatedSymbol": ["Ctrl+Alt+F7"], + "navigate.searchEverywhere": ["Ctrl+T"], + "navigate.showBookmarks": ["Ctrl+`", "Ctrl+K W", "Ctrl+K Ctrl+W"], + "navigate.superMethod": ["Alt+Home"], + "navigate.toggleBookmark": ["Ctrl+K K", "Ctrl+K Ctrl+K"], + "navigate.typeDeclaration": ["Ctrl+Shift+F11"], + "navigate.typeHierarchy": ["Ctrl+E H", "Ctrl+E Ctrl+H"], + "refactor.changeSignature": ["Ctrl+R S", "Ctrl+R Ctrl+S"], + "refactor.extractField": ["Ctrl+R F", "Ctrl+R Ctrl+F"], + "refactor.extractMethod": ["Ctrl+R M", "Ctrl+R Ctrl+M"], + "refactor.extractParameter": ["Ctrl+R P", "Ctrl+R Ctrl+P"], + "refactor.extractVariable": ["Ctrl+R V", "Ctrl+R Ctrl+V"], + "refactor.inline": ["Ctrl+R I", "Ctrl+R Ctrl+I"], + "refactor.move": ["Ctrl+R O", "Ctrl+R Ctrl+O"], + "refactor.rename": ["Ctrl+R R", "Ctrl+R Ctrl+R"], + "refactor.safeDelete": ["Ctrl+R D", "Ctrl+R Ctrl+D", "Alt+Delete"], + "refactor.thisMenu": ["Ctrl+Shift+R"], + "run.chooseConfig": ["Ctrl+Alt+Shift+R"], + "run.debug": ["Alt+F5"], + "run.rerun": ["Ctrl+Shift+F5"], + "run.run": ["Ctrl+F5"], + "run.runContext": ["Ctrl+Alt+F5"], + "run.stop": ["Shift+F5"], + "toolwindow.build": ["Alt+0"], + "toolwindow.commit": [], + "toolwindow.database": ["Ctrl+Alt+3"], + "toolwindow.find": ["Alt+3", "Ctrl+Alt+F12"], + "toolwindow.jumpToLast": ["Ctrl+Alt+Backspace", "Alt+Shift+F6"], + "toolwindow.project": ["Ctrl+Alt+L", "Alt+1"], + "toolwindow.services": [], + "toolwindow.structure": ["Ctrl+Alt+F"], + "toolwindow.terminal": ["Ctrl+Alt+1"], + "vcs.commit": ["Ctrl+Alt+K"], + "vcs.commitAndPush": ["Ctrl+Alt+Shift+K"], + "vcs.nextChange": ["Ctrl+Alt+Shift+N"], + "vcs.operations": ["Ctrl+Alt+Q"], + "vcs.prevChange": ["Ctrl+Alt+Shift+P"], + "vcs.showMessageHistory": ["Ctrl+H"], + "vcs.update": ["Ctrl+Alt+W"], + "view.quickSwitchScheme": [], + "view.zoomIn": [], + "view.zoomOut": [], + "window.toggleFullScreen": ["Alt+Shift+Enter"], + // Inherited keys this keymap gives to other actions. + "code.applyQuickFix": [], + "code.foldSelection": [], + "debug.rerun": [], + "editor.inlineCompletion.trigger": [], + "navigate.nextHighlightedUsage": [], + "navigate.prevHighlightedUsage": [], + "navigate.showFilePath": [], + "run.updateApplication": [], + "toolwindow.resizeDown": [], + "toolwindow.resizeUp": [], + "vcs.shelveSilently": [], + "window.nextTab": [], + "window.previousTab": [], +};