-
Notifications
You must be signed in to change notification settings - Fork 38.2k
Description
Notes
- This is a regression introduced in vscode 1.67 (also affects 1.68 and insiders)
- The reproduction steps require a language server that produces completion items using the
$0placeholder. The example steps use clangd
Steps to reproduce
(See also screen recordings below)
- Install the clangd C++ language server
- Start with the following C++ source file:
void moo(int, int);
int main() {
}- On line 4, type
moand invoke completion. - Accept the completion item for
moo. - Type
decland invoke completion - Accept the completion item for
decltype(expression)
Expected results
The cursor ends up at column 26, i.e. just before the closing ) of the inserted decltype(expression).
This is what happens with vscode 1.66:
Actual results
The cursor ends up at column 27, i.e. just after the closing ) of the inserted decltype(expression)
This is what happens with vscode 1.67 and later:
Analysis
The bug seems to hinge on the second completion item containing a $0 placeholder -- in this case, the item's insertText is decltype(${0:expression}). If this is changed to decltype(${1:expression}), the bug goes away.
The interpretation of the $0 placeholder is explained in the LSP spec here: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#insertTextFormat
Originally reported at clangd/clangd#1190.

