Kommand
← Back to blog

October 17, 2026 · By Kommand

VS Code Comment Shortcut Not Working on Mac?

Check the keyboard layout, editor focus and competing bindings. Then distinguish toggling comments from adding or removing them.

The tutorial says ⌘/. You press it. Nothing happens. On a German keyboard, even typing / involves ⇧. Adding more modifiers at random is unlikely to make this less confusing.

Run Toggle Line Comment from the Command Palette first. If it works, the command is available and you can investigate the binding. If it doesn't, check the editor and language mode before changing any keys.

Run the command without its shortcut

Use a disposable file rather than an unfinished edit. A small JavaScript example keeps the test unambiguous because the language has a familiar line-comment marker.

const reviewDay = "Friday";
console.log(reviewDay);
  1. Create a new file and enter the two lines above. Set its language mode to JavaScript using the language indicator in the status bar.
  2. Place the cursor in a code line. Open View → Command Palette, then search for Toggle Line Comment and run it.
  3. Check whether the line becomes a comment. Run the command again to toggle it back.

If the command works, inspect its binding

Open the Keyboard Shortcuts editor using Preferences: Open Keyboard Shortcuts in the Command Palette. Search for Toggle Line Comment, or use its command identifier: editor.action.commentLine.

Read the combination shown for your installation. VS Code renders bindings for the current layout; a US-keyboard screenshot is not a reliable map of the keys printed on a German keyboard.

If the combination is awkward, use the editor’s change-keybinding action and press the combination you want. Recording the keys is safer than guessing which US character belongs in a configuration file.

Check which command wins

Two bindings can use the same keys and be active in different places. A shortcut that works in the code editor may do something else while the terminal or search box has focus.

In the Keyboard Shortcuts editor, right-click the entry and choose Show Same Keybindings. Check the other commands and their When conditions. Pay attention to entries supplied by your own settings or an extension.

For a closer look, run Developer: Toggle Keyboard Shortcuts Troubleshooting from the Command Palette. Press the problem combination, then inspect the Output log for the detected keys and resolved command. Run the troubleshooting command again when you are finished to turn logging off.

If the command itself does nothing

Return focus to an editable code line. Check the language mode, whether the file is read-only, and whether you are in an editor rather than a preview. Plain Text is not a good test of a programming language’s comment syntax.

Compare the disposable JavaScript example with the file where the problem started. If only the original file fails, look at its language support and editor context before changing a system-wide shortcut.

Leave the rest of your keybindings alone while you investigate. Resetting all of them can remove useful customizations without fixing the file you are trying to comment.

Toggle, add and remove are different commands

A toggle is convenient on a single line. When you want an explicit result, VS Code also has separate add-comment and remove-comment commands. The usual Mac bindings below can be changed; check them in your own Keyboard Shortcuts editor.

VS Code line-comment commands on Mac
CommandTypical US-layout bindingCommand identifier
Toggle Line Comment⌘/editor.action.commentLine
Add Line Comment⌘K → ⌘Ceditor.action.addCommentLine
Remove Line Comment⌘K → ⌘Ueditor.action.removeCommentLine

The arrow means press, release, then press

⌘K → ⌘C is a chord with two steps. Press ⌘K, release it, then press ⌘C. Do not hold K and C down together. The status bar can show that VS Code is waiting for the second step.

Kommand, which we build, can store both steps as a sequence for reference and practice. Set the binding in VS Code first, then save the combination that works on your keyboard.

Written by Kommand. This article is part of our Mac keyboard shortcut series.

Related articles