Skip to content

Fix #2687: correct postfix completion text when selected by mouse click - #3851

Open
MeherSru wants to merge 1 commit into
eclipse-jdtls:mainfrom
MeherSru:fix-2687-postfix-mouse-click-completion
Open

Fix #2687: correct postfix completion text when selected by mouse click#3851
MeherSru wants to merge 1 commit into
eclipse-jdtls:mainfrom
MeherSru:fix-2687-postfix-mouse-click-completion

Conversation

@MeherSru

Copy link
Copy Markdown
Contributor

sysout, syserr and the other postfix suggestions only built the
actual code when the editor asked for it in a separate step (resolve).
VS Code skips that step when you click with the mouse, so clicking
inserted broken placeholder text instead. Now the actual code is
ready right away, so clicking works the same as pressing Enter.

… by mouse click

Postfix templates (sysout, syserr, etc.) computed their real text and
replacement range lazily, only during completionItem/resolve. Clients
that skip resolve on mouse-click (e.g. VS Code) inserted the unresolved
placeholder text instead. Postfix completion now always computes the
final text eagerly and anchors its edit the same way other completion
items do, so behavior no longer depends on resolve being called.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@MeherSru
MeherSru marked this pull request as ready for review July 17, 2026 17:23
@datho7561

Copy link
Copy Markdown
Contributor

Sorry, I should have looked into this issue a bit more before asking you to look into it. I read through #2687 and microsoft/vscode#183092, and it seems pretty messy.

The main problem with the approach you took here (removing resolve for postfix completions) appears to be that resolve was added for postfix completion in the first place because calculating the completion was having a noticeable performance impact. Even though this will fix the completion, this change will also reintroduce the performance issue. There was some discussion upstream from the VS Code team about providing some alternative solution for resolving the completion properly in a way that doesn't break the spec. However, it looks like there's been no movement upstream.

I tend to believe that it's better for the completion results to be correct than to save a bit of time. I'll ask the folks from Microsoft who first implemented resolve for postfix completions what they think in the original issue, and if they've heard anything else about https://github.com/microsoft/vscode/issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants