cssvisual-studio-codecomments

How can I avoid VS Code editor quick suggestions in comments in CSS files when typing `:`?


When I type : in a comment in a CSS file, VS Code shows a popup with suggestions to autocomplete with any CSS pseudo-element and pseudo-class. Screenshot attached.

screenshot showing the issue I just described

How can I avoid this?

Here are my settings related to this issue:

{
    "editor.formatOnType": true,
    "editor.quickSuggestions": {
        "other": "on", // default
        "comments": "off", // default
        "strings": "off" // default
    },
    "editor.snippetSuggestions": "bottom",
    "editor.suggest.localityBonus": true,
    "editor.suggest.preview": true,
    "editor.wordBasedSuggestions": "off",
    "emmet.excludeLanguages": ["markdown", "css"],
}

I have removed them all, but it still happens.


Solution

  • This is suggestions on trigger characters. I'd suggest you raise an issue ticket in the VS Code CSS language support repo asking that it don't provide suggestions in comment contexts (following a principle stated by one of the VS Code maintainers).

    You could work around the issue by disabling suggest on trigger characters for CSS, but that would affect all contexts in CSS- not just within comments.

    "[css]": {
        "editor.suggestOnTriggerCharacters": false,
    },