https://bugs.kde.org/show_bug.cgi?id=445085

--- Comment #2 from oldherl <oldh...@gmail.com> ---
(In reply to Waqar Ahmed from comment #1)
> json which has a field "insertText" that is inserted once you press "Enter".


Hello. I did some logging and research around it. It seems that the field
"insertText" is missing in current rust-analyzer, and it's using "textEdit"
instead. Here's a CompletionItem JSON object I receive from LSP in function
parseDocumentCompletion:
"{
    "additionalTextEdits": [
    ],
    "deprecated": false,
    "detail": "fn(&self) -> <Self as ToOwned>::Owned",
    "documentation": {
        "kind": "markdown",
        "value": "Creates owned data from borrowed data, usually by
cloning.\n\n# Examples\n\nBasic usage:\n\n```rust\nlet s: &str = \"a\";\nlet
ss: String = s.to_owned();\n\nlet v: &[i32] = &[1, 2];\nlet vv: Vec<i32> =
v.to_owned();\n```"
    },
    "filterText": "to_owned",
    "kind": 2,
    "label": "to_owned (as ToOwned)",
    "sortText": "ffffffff",
    "textEdit": {
        "newText": "to_owned",
        "range": {
            "end": {
                "character": 8,
                "line": 2
            },
            "start": {
                "character": 6,
                "line": 2
            }
        }
    }
}
"
I found it in the spec of LSP:
https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#completionItem
It says:
         * An edit which is applied to a document when selecting this
completion.
         * When an edit is provided the value of `insertText` is ignored.

So we need to implement the support for textEdit field of CompletionItem.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to