Skip to content

Problem with Range in TextDocumentContentChangeEvent #29

Open
@slzatz

Description

@slzatz

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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions