Skip to content

Bug: Empty textEdit.newText in the response of the textDocument/completion method #105

@darklam

Description

@darklam

First of all many thanks for making this LSP happen; I've been waiting for this for years! ❤️

Now the issue is that the LSP returns a response for the textDocument/completion method with the newText always being an empty string and start/end being the same character. I think this breaks the completion in the Zed editor, so when trying to insert the completion nothing happens. In VS Code there might be different fallbacks for this case and it works.

Example response:

"textEdit": {
            "newText": "",
            "insert": {
                "start": {
                    "line": 75,
                    "character": 15
                },
                "end": {
                    "line": 75,
                    "character": 15
                }
            },
            "replace": {
                "start": {
                    "line": 75,
                    "character": 15
                },
                "end": {
                    "line": 75,
                    "character": 15
                }
            }
        }

This seems to happen on purpose in the LSAbstractCompletionProvider where textEdit is set to emptyTextEdit().


Perhaps this is to implement the first mode described in the spec, but in this case the textEdit should be omitted completely if I understand it correctly.

This might be a misunderstanding on my part and not an issue, as I don't really know much about the LSP specification, but I saw that there was this issue in Zed and not in VS Code and wanted to dig around to figure out why.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions