英文:
How can I disable parameter auto-completion when selecting a suggested function in VS Code with the clangd extension?
问题
在使用VS Code时,当输入函数名的前缀时,IDE会提供选择。使用clangd扩展时,如果建议是一个函数,并且用户使用Tab键选择它,VS Code将自动完成参数列表并进入奇怪的编辑模式。然而,有时当用户想将函数用作函数指针时,这个功能可能会很烦人。
我尝试在VS Code设置中禁用此功能(例如禁用嵌入式提示等),以及在clangd设置中(未能在官方文档中找到任何相关选项)。如果我在VS Code中将editor.suggest.showFunctions
设置为false
,则将不再提供建议的函数,这不是我想要的。
英文:
When typing the prefix of a function name in VS Code, the IDE will provide suggestions to choose from. When using the clangd extension, if the suggestion is a function and the user selects it using the Tab key, VS Code will automatically complete the parameter list and enter a strange editing mode. However, sometimes when the user wants to use the function as a function pointer, this feature can be annoying.
This is the suggestions.
After selecting, the content within the red box will be automatically completed.
I have tried to disable this feature in both VS Code settings (such as disabling Inlay hints, etc.) and clangd settings(not been able to find any relevant options in the official documentation for clangd).
If I set editor.suggest.showFunctions
to false
in VS Code, there will be no more suggested functions, which is not what I want.
答案1
得分: 2
以下是翻译好的内容:
尝试将以下内容放入您的 settings.json 文件 中:
{
"clangd.arguments": [
"--function-arg-placeholders=0"
],
}
此信息由 Disable function/method arugment insertion.!? #92 提供。
供您参考/学习,我通过在 VS Code clangd 扩展的 GitHub 问题页面 中搜索 ""is:issue function argument
" 找到了该问题票。
在更多澄清内容添加之前的旧回答:
这难道不只是需要将 "editor.parameterHints.enabled": false
放入 settings.json 中吗?
如果您希望此设置仅适用于 C++ 文件,则可以将设置包装在 [cpp]: { ... }
中。
如果您使用 vscode-cpptools 扩展,还与 C_Cpp.autocompleteAddParentheses
(默认值为 false
)相关。
clangd 扩展的配置贡献可以在此处找到,但我认为您只需要 editor.parameterHints.enabled
。
英文:
Try putting the following in your settings.json file:
{
"clangd.arguments": [
"--function-arg-placeholders=0"
],
}
This information provided courtesy of Disable function/method arugment insertion.!?
#92.
For your reference / learning purposes, I found that issue ticket by searching "is:issue function argument
" in the GitHub issues page for the VS Code clangd extension.
Old answer before more clarification was added:
Is this not just a case of having to put "editor.parameterHints.enabled": false
in settings.json?
If you want this setting to only apply to C++ files, then you can wrap the setting in [cpp]: { ... }
.
Also related if you're using the vscode-cpptools extension: C_Cpp.autocompleteAddParentheses
(default value is false
).
The clangd extension configuration contributions can be found here, but I think all you need is editor.parameterHints.enabled
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论