-
Notifications
You must be signed in to change notification settings - Fork 401
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
Fix the wrong additional text edit when complete import statement #1944
Conversation
Signed-off-by: Sheng Chen <[email protected]>
I can't reproduce the issue with vscode. I see the extra textedit in the tests, if I remove your fix, but don't see that same textedit in vscode-java 1.0 |
Make sure the compilation unit does not have any import statement at first. and then write them like this: import.mp4 |
still nope Screen.Recording.2021-11-17.at.12.16.54.mov |
Interesting, is that the power of M1 chip? What if you hit |
I'm able to reproduce. Some observations :
Given the potential relation to the state of the AST, might this be related to #1918 ? |
Thank you @rgrunber! I'll take some more investigation. |
@fbricon Did you set the system property |
After some investigation, I got some new findings. In the code CompletionResolveHandler@line:114, if I added So it looks like a race condition between the completion resolve request and the validation job in the document lifecycle. Next step I'll think about how to solve it more 'elegantly'. |
Reopen it since this could be a quick solution for this specific problem. But for long-term, will keep looking at the race condition issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I type import ja
and trigger completion very fast, i can reproduce the issue. The adaptive debounce with validation can reduce the probability of race condition.
Also since we have already used similar logic to skip import rewriting from within the import section. See computeJavaTypeReplacementString
. This PR is doing the same thing for additional import, it makes sense to me.
fix redhat-developer/vscode-java#1422.
No need to add import when user is complete on an import statement.
Signed-off-by: Sheng Chen [email protected]