【发布时间】:2016-12-14 10:30:48
【问题描述】:
我不想在 Visual Studio Code 中对 Markdown 文件进行单词补全,如何禁用它?理想情况下,仅适用于 Markdown,但在最坏的情况下,即使是全局切换也是好的。
【问题讨论】:
标签: intellisense visual-studio-code
我不想在 Visual Studio Code 中对 Markdown 文件进行单词补全,如何禁用它?理想情况下,仅适用于 Markdown,但在最坏的情况下,即使是全局切换也是好的。
【问题讨论】:
标签: intellisense visual-studio-code
可以使用editor.quickSuggestions、editor.acceptSuggestionOnEnter 和editor.suggestOnTriggerCharacters settings 配置VS Code 中的IntelliSense 建议globally or per each workspace 和1.9 per file-type (language)。
// Controls if quick suggestions should show up or not while typing
"editor.quickSuggestions": true,
文件类型设置(首选,自 1.9 版本起)
按 F1 打开Command Palette 并运行Configure language specific settings 命令,然后选择Markdown。
将打开一个新的编辑器窗格,您可以在其中放置这些设置:
// Place your settings in this file to overwrite the default settings
{
"[markdown]": {
"editor.quickSuggestions": false
}
}
这样您将只对降价文件禁用 IntelliSense。
全球
按F1打开Command Palette,输入open user settings并按Enter。将打开一个新的编辑器窗格,您可以在其中放置这些设置:
// Place your settings in this file to overwrite the default settings
{
"editor.quickSuggestions": false
}
工作区
Workspace settings 允许设置自定义设置,而无需将它们应用于您的其他 VS Code 项目。工作区设置文件位于项目中的.vscode 文件夹下。
按F1打开Command Palette,输入open workspace settings并按Enter。当您可以放置与上面列出的相同的片段时,将打开一个新的编辑器窗格。
我不知道当前是否可以将设置与选定的文件类型相关联。
其他配置选项
除了editor.quickSuggestions,还可以更改其他几个选项以进一步自定义 IntelliSense 的工作方式:
// Controls if quick suggestions should show up while typing
"editor.quickSuggestions": false,
// Controls if suggestions should be accepted with "Enter" - in addition to "Tab". Helps to avoid ambiguity between inserting new lines and accepting suggestions.
"editor.acceptSuggestionOnEnter": false,
// Controls the delay in ms after which quick suggestions will show up.
"editor.quickSuggestionsDelay": 10,
// Enable word based suggestions
"editor.wordBasedSuggestions": false,
// Controls if the editor should automatically close brackets after opening them
"editor.autoClosingBrackets": false,
// Controls if suggestions should automatically show up when typing trigger characters
"editor.suggestOnTriggerCharacters": false
【讨论】:
.txt 不被视为一种语言,要明确关闭自动完成...
.txt 文件禁用智能感知的人来说,这对我有用:"[plaintext]": { "editor.quickSuggestions": false }
.txt 的类型是纯文本,请参阅@MrDustpan 的评论,谢谢!你可以这样做:[Ctl-Shift-P] / 配置语言特定设置... / [Enter] / 纯文本 / [Enter] / "editor.quickSuggestions": false / [Ctl-S]
.mdx 文件执行此操作,请注意您必须使用"[mdx]" 而不是"[markdown]"。
PlainText,它涵盖.txt 文件
除了@JakubS 所说的之外,还有两个设置可以帮助消除 IntelliSense:
// Controls if the editor should automatically close brackets after opening them
"editor.autoClosingBrackets": false,
// Controls if suggestions should automatically show up when typing trigger characters
"editor.suggestOnTriggerCharacters": false,
editor.autoClosingBrackets 选项将阻止 Visual Studio Code 自动插入右括号、方括号、大括号、单引号、双引号等。
editor.suggestOnTriggerCharacters 选项将在您键入美元符号或点时阻止自动完成窗口出现。
总的来说,这就是我使用的:
// Controls if quick suggestions should show up while typing
"editor.quickSuggestions": false,
// Controls if suggestions should be accepted with "Enter" - in addition to "Tab". Helps to avoid ambiguity between inserting new lines and accepting suggestions.
"editor.acceptSuggestionOnEnter": false,
// Controls the delay in ms after which quick suggestions will show up.
"editor.quickSuggestionsDelay": 10,
// Enable word based suggestions
"editor.wordBasedSuggestions": false,
// Controls if the editor should automatically close brackets after opening them
"editor.autoClosingBrackets": false,
// Controls if suggestions should automatically show up when typing trigger characters
"editor.suggestOnTriggerCharacters": false
【讨论】:
"editor.suggestOnTriggerCharacters": true。
如果 markdown linting 警告也令人分心,并且您想暂时禁用它们,则可以使用;
CTRL/COMMAND+SHIFT+P
Toggle linting by markdownlint on/off (temporarily)
当你认为你已经完成了一个文档时,你可以启用它。
【讨论】:
这仅适用于纯文本,不适用于降价。我的 settings.json 如下,但我仍然在 .md 文件中获得建议(尽管现在不在 .txt 文件中)。
{
"[markdown]": {
"editor.quickSuggestions": false
},
"[plaintext]": {
"editor.quickSuggestions": false
},
[other entries]
}
【讨论】: