Skip to content

Conversation

@lahodaj
Copy link
Contributor

@lahodaj lahodaj commented Feb 13, 2025

Consider code like:

public class Test {
|
}

And try to slowly type Tes inside VS Code. This will open code completion, and offer to create an initialize-all constructor. But, when the completion item is confirmed, it sometimes happens the action does not do anything (except removing the typed part of the identifier).

The reason is, I think, that the completion is computed for T, and when typing es, the completion is filtered, but not recomputed. But, reparsing the source code (due to the typed characters) may change Element instances, and the lazy computation for TextEdit for inserting the constructor will try to compare original and current Element for equality, and that will fail.

I am not quite clear why there is the Element check, but it would be better to compare e.g. ElementHandles, not Elements.

@lahodaj lahodaj added Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) LSP [ci] enable Language Server Protocol tests VSCode Extension labels Feb 13, 2025
@lahodaj lahodaj added this to the NB26 milestone Feb 13, 2025
@lahodaj lahodaj requested a review from dbalek February 13, 2025 15:18
@lahodaj lahodaj force-pushed the create-initializing-constructor-reparse-in-lazy branch from 9a60753 to 8e94d28 Compare February 21, 2025 14:34
@lahodaj lahodaj merged commit e7b8beb into apache:master Feb 26, 2025
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) LSP [ci] enable Language Server Protocol tests VSCode Extension

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants