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

Problem with Range in TextDocumentContentChangeEvent #29

Open
slzatz opened this issue Aug 11, 2021 · 3 comments
Open

Problem with Range in TextDocumentContentChangeEvent #29

slzatz opened this issue Aug 11, 2021 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@slzatz
Copy link

slzatz commented Aug 11, 2021

When generating a textDocument/didChange notification from a client you run into the following problem if you want to indicate that the content you are sending to the server is the entire document.

As you note in the comments: "If range and rangeLength are omitted the new text is considered to be the full content of the document."

However, you can't omit range in straightforward way unless you make it a pointer and add "omitempty"

So the TextDocumentContentChangeEvent type's Range field (in text.go) would become:

Range *Range `json:"range,omitempty"`

With that change providing no Range produces the correct json (no Range information at all) whereas without the change you get a Range type struct with start and end type structs containing line and character fields set to zero and that is not interpreted by gopls (I haven't checked other lsps) as having omitted the range.

@zchee
Copy link
Member

zchee commented Mar 24, 2022

@slzatz sorry for the delay. will looking it.

@zchee zchee self-assigned this Mar 24, 2022
@create-issue-branch
Copy link

@zchee zchee added the bug Something isn't working label Mar 24, 2022
@nichtverstehen
Copy link

I stumbled upon this too. Are pull requests welcome for this issue? Is it important to maintain API backward compatibility here?

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

No branches or pull requests

3 participants