fannheyward wrote:

@argothiel @HighCommander4 looks like the `replace` and `insert` range is 
incorrect:

clangd 22:

```
{
    "filterText": "iostream>",
    "insertText": "iostream>",
    "insertTextFormat": 1,
    "kind": 17,
    "label": "iostream>",
    "labelDetails": {},
    "score": 0.787254273891449,
    "sortText": "40b67681iostream>",
    "textEdit": {
        "newText": "iostream>",
        "range": {
            "end": { "character": 13, "line": 0 },
            "start": { "character": 10, "line": 0 }
        }
    }
},
```

clangd 23:

```
{
    "filterText": "iostream>",
    "insertText": "iostream>",
    "insertTextFormat": 1,
    "kind": 17,
    "label": "iostream>",
    "labelDetails": {},
    "score": 0.787254273891449,
    "sortText": "40b67681iostream>",
    "textEdit": {
        "insert": {
            "end": { "character": 13, "line": 0 },
            "start": { "character": 10, "line": 0 }
        },
        "newText": "iostream>",
        "replace": {
            "end": { "character": 12, "line": 0 },
            "start": { "character": 10, "line": 0 }
        }
    }
},
```

clangd 23 changed to use `InsertReplaceEdit`, but returns wrong range. The [LSP 
document](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.18/specification/#completionItem):

>        \* *Note 2:* If an `InsertReplaceEdit` is returned the edit's insert 
> range
         * must be a prefix of the edit's replace range, that means it must be
         * contained and starting at the same position.

The `insert` range must be contained in `replace` range.

https://github.com/neoclide/coc.nvim/issues/5762

https://github.com/llvm/llvm-project/pull/187623
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to