如何在具有 C++ 扩展的 VS 代码中禁用函数参数的弹出建议

Ari*_*zon 8 c++ intellisense visual-studio-code

我发现来自 VS Code 中 C++ 扩展的大多数建议/智能感知都很有用。但在某些情况下,函数参数的特定弹出窗口可能会分散注意力。

如何将其关闭(不禁用其他建议/智能感知功能)?

在此输入图像描述

Ben*_*est 10

这是IntelliSense的一部分。如果您不想要弹出窗口,可以通过以下几个选项来摆脱它:

\n

关闭弹出窗口

\n

当您想摆脱弹出窗口时,请按退出键。如果您希望自动完成某些内容/提出建议,但您希望保留其他代码片段,那么这会很有帮助。

\n
\n

完全禁用

\n

Visual Studio IDE 和 Visual Studio Code 之间的步骤有所不同,我想在此处提供两者的说明。

\n

Visual Studio (devenv.exe)

\n
    \n
  1. Tools > Options
  2. \n
  3. Text Editor在左侧窗格中选择。
  4. \n
  5. 选择您正在使用的语言(在您的情况下,这是 C++,但您也可以为其他语言关闭此功能)。
  6. \n
  7. 对于 C# 和 Basic,选择IntelliSense. 对于 C/C++,选择Advanced并滚动到该IntelliSense部分。
  8. \n
  9. 对于 C# 和 Basic,请选中Show completion list after a character is typed以禁用它。对于 C/C++,您将有几个选项,例如Disable Auto UpdatingDisable SquigglesDisable #include \xe2\x80\x9cAuto Complete。将其中任何一个设置为 \xe2\x80\x9cTrue\xe2\x80\x9d 将其关闭。
  10. \n
\n

Visual Studio 代码(代码.exe)

\n

您也可以在 VS Code 中禁用自动完成功能,但说明与上面提到的 Visual Studio IDE 不同。以下是您可以在 VS Code 中为 IntelliSense 设置的设置settings.json,其中包括用于启用/禁用 IntelliSense 某些部分的设置:

\n
{\n    // Controls if quick suggestions should show up while typing\n    "editor.quickSuggestions": {\n        "other": true,\n        "comments": false,\n        "strings": false\n    },\n\n     // Controls whether suggestions should be accepted on commit characters. For example, in JavaScript, the semi-colon (`;`) can be a commit character that accepts a suggestion and types that character.\n    "editor.acceptSuggestionOnCommitCharacter": true,\n\n    // Controls if suggestions should be accepted on \'Enter\' - in addition to \'Tab\'. Helps to avoid ambiguity between inserting new lines or accepting suggestions. The value \'smart\' means only accept a suggestion with Enter when it makes a textual change\n    "editor.acceptSuggestionOnEnter": "on",\n\n    // Controls the delay in ms after which quick suggestions will show up.\n    "editor.quickSuggestionsDelay": 10,\n\n    // Controls if suggestions should automatically show up when typing trigger characters\n    "editor.suggestOnTriggerCharacters": true,\n\n    // Controls if pressing tab inserts the best suggestion and if tab cycles through other suggestions\n    "editor.tabCompletion": "on",\n\n    // Controls whether sorting favours words that appear close to the cursor\n    "editor.suggest.localityBonus": true,\n\n    // Controls how suggestions are pre-selected when showing the suggest list\n    "editor.suggestSelection": "recentlyUsed",\n\n    // Enable word based suggestions\n    "editor.wordBasedSuggestions": true,\n\n    // Enable parameter hints\n    "editor.parameterHints.enabled": true,\n}\n
Run Code Online (Sandbox Code Playgroud)\n

如果您想完全禁用代码完成,只需将所有内容设置editor.quickSuggestionsfalse

\n

要仅禁用函数参数建议,请"editor.parameterHints.enabled": false在您的settings.json.

\n