【问题标题】:How to disable IntelliSense in VS Code for Markdown?如何在 VS Code 中为 Markdown 禁用 IntelliSense?
【发布时间】:2016-12-14 10:30:48
【问题描述】:

我不想在 Visual Studio Code 中对 Markdown 文件进行单词补全,如何禁用它?理想情况下,仅适用于 Markdown,但在最坏的情况下,即使是全局切换也是好的。

【问题讨论】:

    标签: intellisense visual-studio-code


    【解决方案1】:

    可以使用editor.quickSuggestionseditor.acceptSuggestionOnEntereditor.suggestOnTriggerCharacters settings 配置VS Code 中的IntelliSense 建议globally or per each workspace1.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 }
    • @Frank Nocke 的评论(现在?)错误,.txt 的类型是纯文本,请参阅@MrDustpan 的评论,谢谢!你可以这样做:[Ctl-Shift-P] / 配置语言特定设置... / [Enter] / 纯文本 / [Enter] / "editor.quickSuggestions": false / [Ctl-S]
    • 如果您尝试使用.mdx 文件执行此操作,请注意您必须使用"[mdx]" 而不是"[markdown]"
    • @FrankNocke 纯文本是一种语言,称为PlainText,它涵盖.txt 文件
    【解决方案2】:

    除了@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
    

    【讨论】:

    • 我认为触发字符可能是特定于语言的。点绝对是 Python 中的触发字符,可能是大多数(如果不是所有)语言。但是当我输入美元符号(在 Python 中)时,没有任何反应,即使我有 "editor.suggestOnTriggerCharacters": true
    【解决方案3】:

    如果 markdown linting 警告也令人分心,并且您想暂时禁用它们,则可以使用;

    CTRL/COMMAND+SHIFT+P
    Toggle linting by markdownlint on/off (temporarily)
    

    当你认为你已经完成了一个文档时,你可以启用它。

    【讨论】:

      【解决方案4】:

      这仅适用于纯文本,不适用于降价。我的 settings.json 如下,但我仍然在 .md 文件中获得建议(尽管现在不在 .txt 文件中)。

      {
          "[markdown]": {
              "editor.quickSuggestions": false
          },
          "[plaintext]": {
              "editor.quickSuggestions": false
          },
          [other entries]
      }
      

      【讨论】:

        猜你喜欢
        • 2021-05-17
        • 1970-01-01
        • 2019-09-15
        • 2020-10-29
        • 1970-01-01
        • 2017-04-29
        • 2018-11-11
        • 1970-01-01
        • 2021-02-09
        相关资源
        最近更新 更多