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

Double #include insertion with clangd #72

Closed
briancarbone opened this issue Aug 5, 2024 · 4 comments
Closed

Double #include insertion with clangd #72

briancarbone opened this issue Aug 5, 2024 · 4 comments

Comments

@briancarbone
Copy link

briancarbone commented Aug 5, 2024

Hi, there. When using clangd as my language server with https://github.com/yegappan/lsp, strange behavior is observed:

① If I select a completion entry and press <Esc>, the corresponding #include for that entry is inserted (which is surprising).
② If I select a completion entry and press, <c-y>, the corresponding #include for that entry is inserted twice. (Additionally, the function signature is entered, but that may just be a clangd "feature.")

Here's a brief video:
https://github.com/user-attachments/assets/4b948808-c992-467b-b5a1-07c843a01334

@girishji
Copy link
Owner

girishji commented Aug 5, 2024

Looks like a bug. I will investigate tomorrow.

girishji added a commit that referenced this issue Aug 6, 2024
LSP client
If `completionTextEdit` is set in LSP client (https://github.com/yegappan/lsp),
it applies LSP supplied text changes twice -- once, when completion candidate
is accepted and second time after `CompleteDone` event is fired. This seems
like a LSP client bug.

Solution: Set completionTextEdit to `false` in LSP client config.

#72
#37
M  autoload/vimcomplete/lsp.vim
@girishji
Copy link
Owner

girishji commented Aug 6, 2024

This looks like LSP client issue (yegappan/lsp#545). In the meantime, you can set completionTextEdit to false in LSP client configuration.

@briancarbone
Copy link
Author

That worked for me with your latest commit. Are there any undesirable side effects of setting completionTextEdit to false? If there are, I suppose you may wish to keep this open so you can set it back to true once the LSP client is fixed.

@girishji
Copy link
Owner

girishji commented Aug 7, 2024

This is a LSP issue. The undesirable side-effect is for typescript server (and others maybe) that make text edits available at a later time. They will not apply text edits. I have opened an issue in LSP, and it needs to be tracked there. This plugin should not set or unset completionTextEdit at all.

@girishji girishji closed this as completed Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants