Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

editor.acceptSuggestionOnCommitCharacter has no effect #347

Open
xvyvx opened this issue Jun 16, 2022 · 8 comments
Open

editor.acceptSuggestionOnCommitCharacter has no effect #347

xvyvx opened this issue Jun 16, 2022 · 8 comments
Labels
bug Something isn't working

Comments

@xvyvx
Copy link

xvyvx commented Jun 16, 2022

editor.acceptSuggestionOnCommitCharacter has no effect when it is enabled( just commit CommitCharacter itself, not selected completion item with CommitCharacter. For example when I select a item from completion list and then input ;, it commit ; only).

By searching relate questions, i found this, so i think clangd has support acceptSuggestionOnCommitCharacter feature, is it just a bug on client side? or maybe I misunderstood it?

@xvyvx xvyvx added the bug Something isn't working label Jun 16, 2022
@HighCommander4
Copy link
Contributor

HighCommander4 commented Jun 21, 2022

This is a bug in vscode-languageclient: microsoft/vscode-languageserver-node#673

As you can see, it has been fixed, but we need to release a new version of vscode-clangd that picks up a version of vscode-languageclient that contains the fix.

There is already a pull request to make this dependency bump (for a different reason), we just need to get it merged: #341 (@sam-mccall / @kadircet, kind reminder)

@xvyvx
Copy link
Author

xvyvx commented Jun 21, 2022

Understood, thanks for your reply. 😄

Just keep this issue open for tracking purpose until fix released.

@HighCommander4
Copy link
Contributor

HighCommander4 commented Jul 15, 2022

Looks like vscode-clangd picked up the fix to vscode-languageclient, but other users complained (#356, #357) and in response vscode-clangd was updated in #358 to use an empty list of commit characters, effectively negating the fix.

I wonder if the list of commit characters is configurable on the user side.

@sam-mccall
Copy link
Member

sam-mccall commented Jul 15, 2022

Definitely open to re-adding them if we can find a default behavior that's reasonable to most people, or an optional behavior that's really useful.

Can i ask precisely what behaviour you want here?

  • interaction with snippets: given void foo(int);, with commit characters enabled, after typing f<enter> you get foo(^), typing f; you get foo(;^), typing f( you get foo((^)). This seems bad, but what is good?
  • suppose you want to type literal f;. It's not a suggested completion, maybe the macro doesn't exist yet. What keystrokes do you type to get it (without having it changed to foo()), or is it ok not to be able to type it?

@xvyvx
Copy link
Author

xvyvx commented Jul 15, 2022

The input sequence is: fo + (, then the result is foo(^).

Additionally:

access array element (e.g. int abc[10]) : a + [ will be abc[^]
access class member (e.g. ABC::test) : A + :: will be ABC::

@sam-mccall
Copy link
Member

sam-mccall commented Jul 15, 2022

(@xvyvx I'm very sorry, i accidentally edited your last reply instead of quoting it! I think I managed to restore it)

The input sequence is: fo + (, then the result is foo(^).

Yeah, this basically isn't possible in vscode or LSP without turning off snippets (i.e. completion of signatures).
See microsoft/vscode#42544

Potentially we could expose this option and turn on commit characters when it's on...

The second question above isn't answered: if fo( becomes foo(), how do you type fo()?

@xvyvx
Copy link
Author

xvyvx commented Jul 15, 2022

@sam-mccall Oh, that’s my mistake, I mean input f and the complete list will be shown, and foo is selected, then input (, foo(^) is in the editor.

Yeah, this basically isn't possible in vscode or LSP without turning off snippets (i.e. completion of signatures).
See microsoft/vscode#42544

yes, it’s seems that clangd vscode extension conflict with vscode commit character insertion behavior ( clangd extension will provide function name + (, so () is doubled, some other extension only provide function name ).
An option can control wether to discard commit character sounds good. But wait…, if I access an array or class member like above example, the discard behavior is not needed ( for ABC::test, A + : should be ABC:, the commit character should be kept ), or this option only affect function name?

@HighCommander4
Copy link
Contributor

The second question above isn't answered: if fo( becomes foo(), how do you type fo()?

With editor.quickSuggestions.other: off:

  1. Type fo(
  2. (Do not, at any point, manually activate completion with Ctrl+Enter or similar)

With editor.quickSuggestions.other: on:

  1. Type fo
  2. Press <Esc> to dismiss the completion proposal dialog
  3. Type (

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants