llvm-project
llvm-project copied to clipboard
[clangd] option to disable adding parenthesis for function with auto-completion
I personally am not a huge fan of having this happening. I would really love to see this option available!
What I mean is kind of like this option: --function-arg-placeholders=0
. This disabling the automatic filling of argument slots. In the same way I'd love to see clangd not adding the parenthesis when auto-completion is used.
@llvm/issue-subscribers-clangd
https://github.com/clangd/clangd/issues/1252 is another request for a configuration option related to what text is inserted when when selecting a completion proposal.
Perhaps it would be appropriate to add both options in the Completion section of the config file?
Should --function-arg-placeholders
be deprecated in favour of a config file option as well, to have everything in one place?
Is there any progress on this issue? This has always been disrupting and annoying for me, as it always duplicates opening parentheses unlike any other editor.
Here's a concrete proposal for a config file syntax that would address this request, https://github.com/clangd/clangd/issues/1252, and supersede --function-arg-placeholders
: add a new key under Completion
called ArgumentLists
, with the following supported values:
Value | Description | Function Example | Template Example |
---|---|---|---|
None |
Nothing inserted in argument list position | std::atan2 |
std::array |
Delimiters |
Empty pair of delimiters inserted | std::atan2() |
std::array<> |
NamePlaceholders |
Delimiters and placeholder arguments are inserted. The placeholders are just the names of the parameters. | std::atan2(y, x) |
std::array<T, N> |
FullPlaceholders |
Delimiters and placeholder arguments are inserted. The placeholders are the names and types of the parameters. (Current behaviour) | std::atan2(float y, float x) |
std::array<typename T, size_t N> |
For backwards compatibility:
- the default would be
FullPlaceholders
(matching the current default behaviour) -
--function-arg-placeholders
would continue to be supported, with:-
--function-arg-placeholders=0
being an alias forArgumentLists: Delimiters
-
--function-arg-placeholders=1
being an alias forArgumentLists: FullPlaceholders
-
If both --function-arg-placeholders
and ArgumentLists
are specified, ArgumentLists
would take precedence (I believe that's the behaviour that falls out of FlagsConfigProvider
in similar cases).
Thoughts?
This would fix all my annoyances I have with clangd in VScode. really hope this gets approved and implemented (soon).! I really love clangd, it really improves my work but I need the None
option to 100% happy with it.! Keeping my fingers crossed!
The idea sounds great to me, too.
It sounds good to me.