-
Notifications
You must be signed in to change notification settings - Fork 408
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
Support postfix completion #2275
Conversation
- Reuse the headless part of code from jdt.ui. - The supported templates in this PR are: cast, else, for, fori, forr, if, nnull, null, sysout, throw, var, while. Signed-off-by: Sheng Chen <[email protected]>
Signed-off-by: Sheng Chen <[email protected]>
This comment was marked as off-topic.
This comment was marked as off-topic.
Signed-off-by: Sheng Chen <[email protected]>
@gayanper In case you are interested in this. |
TODO:
|
...org/eclipse/jdt/ls/core/internal/corext/template/java/PostfixCompletionProposalComputer.java
Outdated
Show resolved
Hide resolved
I just tried this PR and I can observe the same in Neovim with a sort implementation according to spec (it sorts by sortText if present, and if missing by label) |
So far, I haven't figured out a way to avoid the strange ranking behavior, changing completion kind or insert text format do not help neither.
Resolve binding is required since we need to know the type information for some template like |
Signed-off-by: sheche <[email protected]>
test this please |
Signed-off-by: sheche <[email protected]>
This PR is mainly focusing on migrating the current postfix implementation from Eclipse to JDT.LS and make it work in most basic cases. Meanwhile, there are some problems found during the implementation, most of them can also be found in Eclipse as well. I would like to address them in the different PRs to make the commit history much easier to tell the differences we made comparing with the Eclipse implementation. In the future, when we decide to move the headless version to JDT, it will make it clear. The list of issues that I want to address:
|
Current version basically works for me, I'm OK to merge it first to keep the commit history clean. When you open the new PR to address the remaining issues, pls consider how to make the IntelliCode to adopt the postfix as well. |
Signed-off-by: sheche <[email protected]>
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.
With the latest change, postfix works with or without IntelliCode extension. LGTM.
Yup, for some reason |
I'm merging this PR first, but still open to discuss whether the feature should be enabled by default or not. |
fix redhat-developer/vscode-java#1455
fix #863
requires redhat-developer/vscode-java#2746
How to test
Performance analysis
We will only calculate the postfix completions when:
.
In most cases, it just skips the postfix completion calculation.
Below is the CPU sampling when we trigger the completion for the code
args.|
, whereargs
is aString[]
:Though it takes 36% of the CPU times, the time for completion after
.
is relatively fast, so the real response time is still very quick.Overall, the impact of the completion performance is acceptable.
Known issues
sortText
. This seems a bug of VS Code, I've filed an issue.Next step
Signed-off-by: Sheng Chen [email protected]