c# - How can I disable these suggestions in VS Code for ASP.NET Razor Pages? - Stack Overflow

admin2025-04-16  3

In Visual Studio Code, I get suggestions when I type in a Razor file. Pressing Spacebar accepts the suggestion. This is often not the word I wanted to type.

Example:

Pressing Spacebar changes "all" to "allow," which is not what I wanted.

At first, I thought these suggestions could be disabled by diabling quick suggestions for this language, aspnetcorerazor.

So I tried adding this to my settings.json file:

"[aspnetcorerazor]": {
    "editor.quickSuggestions": {
      "other": "off",
      "comments": "off",
      "strings": "off"
    }
},

But that had no effect, even after restarting Visual Studio Code.

How can we disable these suggestions for Razor files?

In Visual Studio Code, I get suggestions when I type in a Razor file. Pressing Spacebar accepts the suggestion. This is often not the word I wanted to type.

Example:

Pressing Spacebar changes "all" to "allow," which is not what I wanted.

At first, I thought these suggestions could be disabled by diabling quick suggestions for this language, aspnetcorerazor.

So I tried adding this to my settings.json file:

"[aspnetcorerazor]": {
    "editor.quickSuggestions": {
      "other": "off",
      "comments": "off",
      "strings": "off"
    }
},

But that had no effect, even after restarting Visual Studio Code.

How can we disable these suggestions for Razor files?

Share Improve this question edited Feb 4 at 5:59 Ruikai Feng 12.3k1 gold badge7 silver badges16 bronze badges asked Feb 3 at 17:08 Eric EskildsenEric Eskildsen 4,8603 gold badges51 silver badges59 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 1

What worked for me was setting editor.wordBasedSuggestions for both html, and aspnetcorerazor:

  "[html]": {
    "editor.wordBasedSuggestions": "off"
  },
  "[aspnetcorerazor]": {
    "editor.wordBasedSuggestions": "off"
  },

Try

"[razor]": {
    "editor.quickSuggestions": {
      "other": "off",
      "comments": "off",
      "strings": "off"
    }

now no suggestions on my side:

On myside,it works even without restarting vs code:

转载请注明原文地址:http://anycun.com/QandA/1744759318a87214.html