If the Comment/Uncomment Line shortcut (Cmd + /) is not working in Visual Studio Code on macOS, while other shortcuts are functioning, there are a few potential causes and solutions to try:

  1. Check keyboard shortcuts:
    Open the Keyboard Shortcuts menu by pressing Cmd + K Cmd + S, then search for "Toggle Line Comment" to ensure it's correctly assigned to Cmd + /[1][3].

  2. Verify language support:
    Ensure you have the appropriate language support installed for the file type you're working with. Some users reported that missing language support can cause commenting issues[2].

  3. Examine conflicting extensions:
    Disable any extensions that might be interfering with the default keybindings, such as language-specific or keymap extensions[2].

  4. Reset VS Code settings:
    If the issue persists, try resetting your VS Code settings to default and reconfiguring them as needed[1].

  5. Check system shortcuts:
    Verify that Cmd + / is not being used by a system-wide shortcut or another application[1].

  6. Troubleshoot keybindings:
    Run the command "Developer: Toggle Keyboard Shortcuts Troubleshooting" from the Command Palette to identify any conflicts or issues with the shortcut[6].

If none of these solutions work, you may need to use an alternative method for commenting, such as:

  • Using the "Toggle Line Comment" command from the Command Palette (Cmd + Shift + P)[3].
  • Manually editing your keybindings.json file to ensure the correct shortcut is assigned[1].

Remember to restart VS Code after making any changes to ensure they take effect[1].


To verify and ensure you have the appropriate language support installed for your file type in Visual Studio Code, follow these steps:

  1. Open the file you're working on in VS Code.

  2. Look at the bottom-right corner of the VS Code window. You should see the language mode of the current file displayed there[7].

  3. If the language mode is not correct or shows as "Plain Text", click on the language mode indicator and select the appropriate language from the list that appears.

  4. If you don't see the correct language in the list, you may need to install a language extension. Here's how:

    • Press Cmd+Shift+X (on macOS) or Ctrl+Shift+X (on Windows/Linux) to open the Extensions view.

    • Search for the language you're working with (e.g., "Python", "JavaScript", etc.).

    • Look for the official or most popular extension for that language.

    • Click "Install" to add the language support.

  5. After installing the language extension, reload VS Code if prompted.

  6. Open your file again and verify that the correct language mode is now selected.

  7. Try using the comment shortcut (usually Cmd+/ on macOS or Ctrl+/ on Windows/Linux) to see if it works correctly now.

If you're still experiencing issues with commenting after verifying language support, you may need to check your keyboard shortcuts or consider resetting VS Code settings[5].