如何在Visual Studio代码中禁用“使用语句(C#)建议”

时间:2018-10-27 15:07:45

标签: c# autocomplete visual-studio-code intellisense omnisharp

我正在使用Visual Studio Code编写C#,但是有一件事使我发疯...

每当我想在文件顶部添加using指令时,当我只想使用名称空间时,它会一直提示“ Using语句”,该结果会导致using块。

例如在顶部:

enter image description here

我开始输入新的使用行,并且总是显示:

enter image description here

由于习惯快速按Enter / tab,我总是不经意地接受建议:

enter image description here

现在我必须每次手动清理它。

那么如何在Visual Studio Code中禁用此特定建议?

2 个答案:

答案 0 :(得分:1)

我找到了! 扩展程序已下载到(对于Windows)

c:\Users\Username\.vscode\extensions

此“使用语句”建议是C#扩展附带的。

所以在里面

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

删除以下几行使其消失:

"Using statement": {
    "prefix": "using",
    "body": [
        "using (${1:resource})",
        "{",
        "    $0",
        "}"
    ],
    "description": "Using statement"
},

答案 1 :(得分:0)

如果我正确理解了您的问题,那么我认为这无法解决。

转动Intellisense的一部分是不可能的。

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

编辑,这比顶部更重要!! 当然,有多种方法可以改变智能感知的行为,但是我对此并没有真正的经验。 https://code.visualstudio.com/docs/editor/intellisense