0

I am using Visual Studio Code to write C#, however one thing is driving me crazy...

Whenever I want to add a using directive at the top of the file, it keeps suggesting the "Using statement" which results in a using block, when I just wanted to use a namespace.

For example at the top:

enter image description here

I begin typing a new using line and this always shows up:

enter image description here

I always inadvertently accept the suggestion due to quickly hitting enter/tab by habit:

enter image description here

And now I have to manually clean it up ... every time.

So how do I disable this specific suggestion in Visual Studio Code?

Chanon
  • 383
  • 3
  • 8

2 Answers2

1

I found it! Extensions are downloaded into (for Windows)

c:\Users\Username\.vscode\extensions

This "Using statement" suggestion came with the C# extension.

So inside

c:\Users\Username\.vscode\extensions\ms-vscode.csharp-1.16.2\snippets\csharp.json

removing the following lines made it go away:

"Using statement": {
    "prefix": "using",
    "body": [
        "using (${1:resource})",
        "{",
        "    $0",
        "}"
    ],
    "description": "Using statement"
},
Chanon
  • 383
  • 3
  • 8
0

If I understand your question right then I don't think this can be solved.

Turning a part of Intellisense of is impossible.

Is there any way to disable intellisense for a specific project / namespace / whatever?

EDIT, that is more important than the top part!!: Of course there are ways to change the behaviour of intellisense but I'm not really experienced with that. https://code.visualstudio.com/docs/editor/intellisense