最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin2浏览0评论

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.

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.

Share Improve this question edited Mar 19 at 17:54 Germán Freixinós asked Mar 19 at 17:53 Germán FreixinósGermán Freixinós 51 silver badge3 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 0

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,
},

You can set editor.suggestOnTriggerCharacters to false by entering the settings using ctrl+,.

If that doesn't work, it is probably being overridden by a language specific setting.

发布评论

评论列表(0)

  1. 暂无评论