我不想在Visual Studio Code中为Markdown文件启用单词自动完成,如何禁用它?最好只针对Markdown文件禁用,但在最坏的情况下,全局禁用也可以。
我不想在Visual Studio Code中为Markdown文件启用单词自动完成,如何禁用它?最好只针对Markdown文件禁用,但在最坏的情况下,全局禁用也可以。
editor.quickSuggestions
, editor.acceptSuggestionOnEnter
和editor.suggestOnTriggerCharacters
设置。请注意保留{和}符号。// Controls if quick suggestions should show up or not while typing
"editor.quickSuggestions": true,
自从VSCode 1.11 版本以来,quickSuggestions
设置允许更加细粒度地控制快速建议。然而,该设置只接受布尔值或匹配IQuickSuggestionsOptions
的对象,并默认为true
。将其设置为false
会完全禁用快速建议。
文件类型设置(推荐使用1.9版本以上)
按下F1打开命令面板,运行配置语言特定设置
命令,然后选择Markdown
。
一个新的编辑器窗格将打开,您可以在其中放置这些设置:
// Place your settings in this file to overwrite the default settings
{
"[markdown]": {
"editor.quickSuggestions": false
}
}
open user settings
并按Enter。将打开一个新的编辑器窗格,在其中可以放置这些设置:// Place your settings in this file to overwrite the default settings
{
"editor.quickSuggestions": false
}
工作区
工作区设置 允许您在不应用于其他 VS Code 项目的情况下设置自定义设置。 工作区设置文件位于项目中的 .vscode
文件夹下。
按下 F1 打开 命令面板, 输入 打开工作区设置
并按下 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
除了 @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
,仍然不会有任何反应。 - John Y这只适用于纯文本,而不是Markdown。我的settings.json如下,但我仍然在.md文件中获得建议(尽管现在不在.txt文件中)。
{
"[markdown]": {
"editor.quickSuggestions": false
},
"[plaintext]": {
"editor.quickSuggestions": false
},
[other entries]
}
如果你也觉得Markdown的警告信息干扰了你的工作,想要暂时禁用它们,你可以使用以下方法:
CTRL/COMMAND+SHIFT+P
Toggle linting by markdownlint on/off (temporarily)
当你认为一个文档已经完成时,可以启用它。
.txt
文件的 IntelliSense 的人,以下内容可以实现此功能:"[plaintext]": { "editor.quickSuggestions": false }
- MrDustpan.txt
文件类型来说,类型应该是纯文本,请参考@MrDustpan的评论,谢谢!您可以执行以下操作: [Ctl-Shift-P] / 配置语言特定设置... / [Enter] / 纯文本 / [Enter] /"editor.quickSuggestions": false
/ [Ctl-S] - Kai Carver.mdx
文件来完成这个任务,请注意你需要使用"[mdx]"
而不是"[markdown]"
。 - shreyasminocha.txt
文件。 - Don Rhummyeditor.quickSuggestions
选项不再是布尔值。相反,它是一个哈希表,如下所示:"editor.quickSuggestions": { "other": false, "comments": false, "strings": false }
- Alessandro