-
-
Notifications
You must be signed in to change notification settings - Fork 55
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
🐛 BUG: LSP completions return incorrect ranges in some cases #664
Comments
Hmm, we don't touch completion ranges (apart from frontmatter edits) in our code, so if there is an issue, it's highly likely to be upstream. (Only chance it's on us if it's related to mappings, but I doubt it is?) I'd say that I typically consider VS Code's implementation to be the "reference implementation" for LSP and if another editor exhibits a wrong behavior, it's generally its problem. Nonetheless, if there is something we can fix, I'd definitely love to do it |
At this time, the only way to address this issue on the client side may be to disable However, disabling |
IMO, This issue already solved in latest @astrojs/language-server. @Trildar Could you test with latest |
This does appear to be fixed now. Checked on 2.8.4 |
Awesome! |
Describe the Bug
Under some circumstances, responses to
completionItem/resolve
calls seem to have the wrong range.For example, in a file like the above, replacing the
test
in id and inserting a completion fortest
results in the followingcompletionItem/resolve
request and response:Request
Response
The response gives a range starting at character 21 instead of character 11 as it should be.
Additional Notes
Testing done in Neovim; refer to the linked nvim-cmp issue below for a reproduction config. Not tested myself, but apparently VS Code, and using Neovim omnifunc completions instead of nvim-cmp, don't have the same completion insert issues, maybe because they don't use
completionItem/resolve
for the insert range (since the ranges returned fortextDocument/completion
are correct) or some other difference in how they interact with the language server.EDIT: The LSP messages do seem to be similar in VS Code. So it's likely that VS Code doesn't use the ranges from
completionItem/resolve
to insert the completion.Some additional cases that produce incorrect ranges can also be found in the nvim-cmp issue below.
Some prior discussion for reference:
hrsh7th/nvim-cmp#1705
LazyVim/LazyVim#1455
Steps to Reproduce
npm init astro
using template sample filessrc/pages/index.astro
with the belowindex.astro
in Neovim with the config from Astro LSP completions sometimes write over incorrect ranges hrsh7th/nvim-cmp#1705 or some similar config using nvim-cmp and the Astro language servertest
in id and try to insert a completion fortest
The text was updated successfully, but these errors were encountered: