Trigger signature help after accepting a function completion.
See original GitHub issueGoodday,
I really enjoy using clangd. Its a must-have tool for every C++ programmer. However, there is one things that really irritates me. Because just as the title implies, it does not give a hover on auto-completing functions/metods. The default is to insert placeholders. Which honestly is weird for an extreme pedant language like C++ to insert illegal syntax (and also spamming the output on functions with a long agrument list). Fortunally it can be turned of with adding this argument.
--function-arg-placeholders=0
This will however break VScode’s hover – which is a way better way to use completing arguments all to getter. So now when auto-completing a function/method it will just type out the function with paranthesis. Regardless of howmany arguments it has. If you want to use the hover you then must press backspace to remove the parenthesis and then retype to parenthesis. Which is irritating me on a daily basis.
Also clangd is not honoring my parenthesis preference with this!
A nice solution whoud be to just not insert the parenthesis. This will force me (which is also conform my preference) to type the parenthesis myself and with that triggering the hover. But there are probably other things you can do inside the VScode plugin API to make the hover show if not using function-arg-placeholders
Thanks for your time for reading this, and please make people like me a bit happier in this world by given us the hover!
Thank You!
– using: clangd version 14.0.6 editor: VScode arguments:
"clangd.arguments": [
"--function-arg-placeholders=0",
"--header-insertion=never",
]
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top GitHub Comments
This is a bit hard to follow, but IIUC there are two complaints:
foo
rather thanfoo()
orfoo(int x)
.The first is actually something clangd does, but we only enable it if the editor doesn’t support rich “snippet completions” (e.g. "insert foo() but place the cursor between the parens). I think this isn’t exposed as an option just because of our perception people don’t want it. Even here it’s not clear to me if it’s important per se or just a workaround for the second problem.
The secord problem is a VSCode-specific limitation/bug, this works OK in other editors. VSCode says the extension should provide an explicit hint to do this (https://github.com/microsoft/vscode/issues/31290) and the owners of the VSCode LSP library + LSP itself seem to think this hint should come via LSP, but haven’t added it to LSP yet. (https://github.com/microsoft/language-server-protocol/issues/274). I think we can work around this bug on the client-side by injecting the hint ourselves in the middleware.
I’m going to transfer this to the vscode-clangd repo since the second issue seems more important and is vscode-specific.
Yes, but the reason for that is that you’re not using the reguar signature-help. Instead - for what ever reason - you desided to go with the snippet engine for functions/methods which is not the way the editor is intended to work. No other language does this. This is your design choice, not that of VScode.
Maybe you can make an option to either use the [currently used] snippet-engine or the [requested] signature-help. But honestly I think the snippet-engine is inferieur in every way. Just look at @wtdcode issue and the fact it is generating illegal syntax and just a lot of spam on long argument lists, and lastly also not showing the function/method documentation (comment above the function/method).