-
Notifications
You must be signed in to change notification settings - Fork 121
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
Send valid document range for textDocument/format #1177
Comments
Thanks for the report. I'll aim to look into this next week. |
I've started to look into this. First off, I get that specifying the end of the current/original document as the end of the range (rather than just picking the largest possible number) would likely fix Kate. Before doing that, I'm keen to understand why this is breaking Kate (for my own edification, if nothing else). Regarding the spec, I don't think Digging into Kate a little, I can see that the Actually, having dug yet further, it looks like |
Getting the correct line number to use in the range end should be fairly straightforward ( It would be good to better understand the issues that Kate is having before going down this route. |
(Of the top of my head) A range containing 0 -> MAX_VALUE, if invalid, would most likely be converted to an empty range by the MovingRange (think of it as a smart range that automatically adapts to text changes in the document) I think. Thus remove text fails i.e., removes nothing and we end up duplicating the document.
It would be utf-16 based IIUC second para. Or I would do whatever vscode does to get column number correctly. Regardless, this issue can actually be solved on the Kate side by doing what VSCode (and nvim?) does which is snap the range to the end of document if the range is bigger and I am actually considering this since there are other servers having this same problem. Also see microsoft/language-server-protocol#257 for a similar issue. |
Code editor
Kate
Platform
Linux
Version
No response
What steps will reproduce the bug?
For the
textDocument/format
request, this server sends an invalid range as reply with the end set to MAX_VALUE instead of the actual end. This breaks some clients such as Kate.How often does it reproduce? Is there a required condition?
No response
What is the expected behavior?
Valid document range
What do you see instead?
Invalid document range
Additional information
bash-language-server/server/src/shfmt/index.ts
Line 55 in 23fdaa9
IIUC, such special values are against the spec https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#position.
The text was updated successfully, but these errors were encountered: