[clang] [clang-tools-extra] [clangd] Add InsertReplaceEdit for code completion (PR #187623)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 29 06:38:31 PDT 2026
argothiel wrote:
These are two different things:
VS Code always advertises `insertReplaceSupport: true`. It means that as an LSP client, it can support both modes: a simple TextEdit range, or a more convoluted InsertReplaceEdit range.
clangd as an LSP server has always been sending a simple TextEdit range. And `vscode-clangd` has always been expecting a simple TextEdit range.
Now, if an LSP server doesn't support an InsertReplaceEdit range, then VS Code will use the same TextEdit range as both replace and insert, regardless of the `editor.suggest.insertMode` setting. That's why the `vscode-clangd` plugin has been working fine.
But when the LSP server supports an InsertReplaceEdit range, it will always send it to the client as a two-field structure (insert and replace), which is handled fine by VS Code, but is not handled correctly by one of the `vscode-clangd`'s methods. Only after receiving both insert and replace range, VS Code will decide which one to use depending on the `editor.suggest.insertMode` setting.
https://github.com/llvm/llvm-project/pull/187623
More information about the cfe-commits
mailing list