Skip to content

Add Visual Studio Code keymap - #9608

Draft
king-407 wants to merge 2 commits into
apache:masterfrom
king-407:issue-6458-vscode-keymap
Draft

king-407 wants to merge 2 commits into
apache:masterfrom
king-407:issue-6458-vscode-keymap

Conversation

@king-407

@king-407 king-407 commented Sep 10, 2026 •

Copy link
Copy Markdown

Closes #6458.

Adds a Visual Studio Code keymap profile for NetBeans.

This change registers a new Visual Studio Code keymap using the existing NetBeans keymap infrastructure. The profile adds common VS Code-style shortcuts for editor actions, navigation, search, project actions, terminal access, and debugging.

It also adds a macOS-specific keybinding file so shortcuts follow Mac platform conventions where needed.

The shortcuts are mapped to existing NetBeans actions rather than introducing new action implementations.

Local verification:

xmllint --noout ide/defaults/src/org/netbeans/modules/defaults/VSCode-keybindings.xml ide/defaults/src/org/netbeans/modules/defaults/VSCode-keybindings-mac.xml ide/defaults/src/org/netbeans/modules/defaults/mf-layer.xml
git diff --check
ant -f nbbuild/build.xml bootstrap
ant -f ide/defaults/build.xml build

LLM assistance used: OpenAI GPT-5 Codex

Assisted-by: OpenAI GPT-5 Codex

Signed-off-by: king-407 <95581750+king-407@users.noreply.github.com>
@mbien mbien added Editor ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) labels Sep 10, 2026
@apache apache locked and limited conversation to collaborators Sep 10, 2026
@apache apache unlocked this conversation Sep 10, 2026
@matthiasblaesing matthiasblaesing mentioned this pull request Oct 6, 2026
4 tasks done
@ashwintemkar

Copy link
Copy Markdown
Contributor

Comparing this against what I had in #9672, here's what might be worth pulling in (and a couple of things worth double checking):

Shortcuts from the official VS Code reference that aren't mapped yet:

  • Code folding entirely: collapse-fold (Ctrl+Shift+[), expand-fold (Ctrl+Shift+]), collapse-all-folds (Ctrl+K Ctrl+[), expand-all-folds (Ctrl+K Ctrl+])
  • Indent/outdent line: shift-line-right (Ctrl+]), shift-line-left (Ctrl+[)
  • Scroll line up/down: scroll-up (Ctrl+Up), scroll-down (Ctrl+Down)
  • Add/remove line comment as distinct from toggle: comment (Ctrl+K Ctrl+C), uncomment (Ctrl+K Ctrl+U)
  • Peek Definition: goto-source (Alt+F12)
  • Format selection: format bound again to (Ctrl+K Ctrl+F), alongside Shift+Alt+F for the whole document
  • Trim trailing whitespace: remove-trailing-spaces (Ctrl+K Ctrl+X)
  • Expand/shrink selection: select-element-next (Shift+Alt+Right), select-element-previous (Shift+Alt+Left)
  • Close editor (Ctrl+F4) and split editor (Ctrl+) don't seem to be mapped at all yet
  • Quick Fix (Ctrl+.): worth adding as a global shadow pointing at Actions/Source/org-netbeans-modules-editor-hints-FixAction.instance, using D-PERIOD so it resolves to Cmd+. on Mac too (the DTD parses . as VK_PERIOD, C-DOT/VK_DOT isn't a real key, that's actually what tripped up the earlier PR)

Things your PR already has that I'd missed: redo, zoom-text-in/zoom-text-out, clipboard-history, the editor-level in-place-refactoring binding on F2 (I only had the global rename shadow, so in my version F2 wouldn't do in-place symbol rename inside the editor), and complete-line on Ctrl+Shift+Enter. Worth keeping those.

One thing worth double-checking while you're in there: DS-O is currently mapped to Open Project, but the official shortcut sheet has Ctrl+Shift+O as "Go to Symbol" (Actions/Edit/org-netbeans-modules-jumpto-symbol-GoToSymbol.instance), so that one might be worth remapping.

Happy to answer questions on any of this, I went through the official VS Code Windows/Mac shortcut references and cross-checked action names against BaseKit/EditorActionNames and the existing Idea/Eclipse profiles while working on #9672.

@king-407

king-407 commented Oct 7, 2026

Copy link
Copy Markdown
Author

Thanks for the detailed comparison.

I have incorporated the verified mappings from your suggestions, including folding, indent/outdent, scroll up/down, comment/uncomment, format selection, trim trailing whitespace, peek source, Quick Fix, Go to Symbol, and Find Usages.

I also kept the mappings that were already present in this PR, such as redo, zoom, clipboard history, in-place rename, and complete-line.

I skipped the editor split binding for now because I could not verify the exact NetBeans editor action name safely from the existing keymap/action registrations.

Local verification passed:

xmllint --noout ide/defaults/src/org/netbeans/modules/defaults/VSCode-keybindings.xml ide/defaults/src/org/netbeans/modules/defaults/VSCode-keybindings-mac.xml ide/defaults/src/org/netbeans/modules/defaults/mf-layer.xml
git diff --check
ant -f nbbuild/build.xml bootstrap
ant -f ide/defaults/build.xml build

@mbien

mbien commented Oct 7, 2026

Copy link
Copy Markdown
Member

btw feel free to add @ashwintemkar as co-author once the final commit is done.
https://docs.github.com/en/pull-requests/how-tos/commit-changes/creating-a-commit-with-multiple-authors#creating-co-authored-commits-on-the-command-line

You can copy the author line from the other PR by taking its URL and adding .patch.

dev build zip for this PR are on the bottom of the summary page, e.g https://github.com/apache/netbeans/actions/runs/37578209272?pr=9608

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) Editor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a keymap for VS Code

3 participants