vscode-clangd icon indicating copy to clipboard operation
vscode-clangd copied to clipboard

About code completion of function call

Open Wakotu opened this issue 3 years ago • 2 comments

Suppose I define a function like following:

int add(int a, int b);

and when I type add and press enter, the plugin would complete my code like this:

add(int a, int b);

with two vscode placeholders of int a and int b.

When the real parameter of a is a complicated expression and I need to use code completion, I have to press Esc and exit the placeholder mode. Afterwards I have to move my cursor across , and delete subsequent placeholders manually. It troubles me a lot.

I wonder if you can make the code completion work in the placeholder mode just like redhat.java extension or simply remove the completion of formal parameter list.

Wakotu avatar Jul 18 '22 14:07 Wakotu

When the real parameter of a is a complicated expression and I need to use code completion, I have to press Esc and exit the placeholder mode. Afterwards I have to move my cursor across , and delete subsequent placeholders manually. It troubles me a lot.

Nested placeholders seem to work fine for me. I took a screen recording to illustrate what I see:

issue-363

[...] or simply remove the completion of formal parameter list.

It can be disabled by adding --function-arg-placeholders=false to "clangd.arguments".

HighCommander4 avatar Jul 18 '22 16:07 HighCommander4

@HighCommander4 I found it is the editor setting of my vscode that makes a diffrence. Configure settings as follows and the plugin can work like yours.

"editor.suggest.snippetsPreventQuickSuggestions": false

Thank you so much!

Wakotu avatar Jul 19 '22 00:07 Wakotu

@HighCommander4 I found it is the editor setting of my vscode that makes a diffrence. Configure settings as follows and the plugin can work like yours.

"editor.suggest.snippetsPreventQuickSuggestions": false

Thank you so much!

This comment seems to confirm that this is the intended solution on the vscode side, so I think we can close this.

HighCommander4 avatar Dec 16 '22 08:12 HighCommander4