-
Notifications
You must be signed in to change notification settings - Fork 29k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[regression] Incorrect cursor position after nested completion using $0 placeholder #152837
Comments
:cough: :cough: minimal steps
|
What could I have done to provide more minimal reproduction steps in this case? The only thing that comes to mind is writing a custom language server for the purpose of demonstrating the bug, which doesn't seem like a reasonable bar.
Thanks, I didn't realize |
I guess that's a bit silly, since after you've finished typing the I think the preferred behaviour would be the one |
reading the spec:
I don't see why I can see how this might've been the decision made, but as @HighCommander4 pointed out, this behavior actually helped language servers (well, at least clangd) to implement some functionality. It'd be great to hear that there'll still be a way to support these without requiring extra tabs. |
Hey @jrieken, this issue might need further attention. @HighCommander4, you can help us out by closing this issue if the problem no longer exists, or adding more information. |
While we have worked around this in clangd for now, it would be nice to consider the behaviour change described in this comment:
Or alternatively to update the LSP docs as described in this comment to clarify that $0 cannot be a placeholder. |
Hey @jrieken, this issue might need further attention. @HighCommander4, you can help us out by closing this issue if the problem no longer exists, or adding more information. |
This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines. Happy Coding! |
It's not clear what "more information" was being asked for here. The current status of the bug is as I summarized in this previous comment. I believe it remains valid. |
Notes
$0
placeholder. The example steps use clangdSteps to reproduce
(See also screen recordings below)
mo
and invoke completion.moo
.decl
and invoke completiondecltype(expression)
Expected results
The cursor ends up at column 26, i.e. just before the closing
)
of the inserteddecltype(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 inserteddecltype(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'sinsertText
isdecltype(${0:expression})
. If this is changed todecltype(${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/#insertTextFormatOriginally reported at clangd/clangd#1190.
The text was updated successfully, but these errors were encountered: