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

Applying autocomplete can lead to extra chars #67

Open
Guldoman opened this issue Jul 17, 2023 · 0 comments · May be fixed by #68
Open

Applying autocomplete can lead to extra chars #67

Guldoman opened this issue Jul 17, 2023 · 0 comments · May be fixed by #68

Comments

@Guldoman
Copy link
Member

If config.plugins.autocomplete.min_len is greater than 1, when the autocomplete dialog is open, the completion isn't updated until min_len is reached. In servers that reply with a textEdit, this causes the following behavior:

2023-07-17.19-53-50.mp4

In this case config.plugins.autocomplete.min_len was 3.
In the first attempt I'm writing only 2 chars, and then confirming the autocomplete. This leads to those two chars to be kept.
In the second attempt I'm writing 3 chars, enough to trigger an update, so when I confirm the autocomplete, the result is correct.

Two solutions come to mind:

  1. Updating when the autocomplete menu is open.
  2. When applying the textEdit we should manually delete the partial.

Solution 1 could potentially lead to problems with slower servers.
Solution 2 needs a patch to the autocomplete plugin.

For now I'll implement solution 1.

@Guldoman Guldoman linked a pull request Jul 17, 2023 that will close this issue
jgmdev added a commit to jgmdev/lsp that referenced this issue Feb 14, 2024
This change handles issue reported on lite-xl/lite-xl-lsp#67
by restoring previous partial since the completion request is async
and new text could have been written while handling the LSP server
response, which results in invalid insert positions for the received
completion items.

Depends on pragtical/pragtical#66
jgmdev added a commit to pragtical/lsp that referenced this issue Feb 14, 2024
This change handles issue reported on lite-xl/lite-xl-lsp#67
by restoring previous partial since the completion request is async
and new text could have been written by user while handling the 
LSP server response, which can result in invalid insert positions for 
the received completion items.

Depends on pragtical/pragtical#66
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

Successfully merging a pull request may close this issue.

1 participant