-
Notifications
You must be signed in to change notification settings - Fork 374
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
Add chain completions support #2544
Conversation
Related vscode extension PR redhat-developer/vscode-java#3008 |
@rgrunber will you have time to look into this change ? |
org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/preferences/PreferenceManager.java
Outdated
Show resolved
Hide resolved
...core/src/org/eclipse/jdt/ls/core/internal/contentassist/ChainCompletionProposalComputer.java
Outdated
Show resolved
Hide resolved
@rgrunber let me know how it looks now, so if things look good, I can see to add some tests. |
I think the postfix completion tests and chain ones were done in the exact same way in JDT-UI. So I would have a look at https://github.com/eclipse-jdt/eclipse.jdt.ui/blob/master/org.eclipse.jdt.text.tests/src/org/eclipse/jdt/text/tests/contentassist/ChainCompletionTest.java for test ideas and https://github.com/eclipse/eclipse.jdt.ls/blob/master/org.eclipse.jdt.ls.tests/src/org/eclipse/jdt/ls/core/internal/handlers/PostfixCompletionTest.java for how the utility methods were written that do the actual testing. Hope to find some time to have another look at this. |
I added one test, But i can also include the similar scenarios in JDT UI Chain Completion, if you think the approach of this implementation is good to be included in JDT.LS. I have done a additional thing to discover the context specific entry points to find completions at @rgrunber Let me know what you think so we can finish this soon. |
...core/src/org/eclipse/jdt/ls/core/internal/contentassist/ChainCompletionProposalComputer.java
Outdated
Show resolved
Hide resolved
It works well for me, and as long as we disable by default, I think it should be fine to merge. only other thing I noticed is that since we started using the We could always address this in a subsequent change though. |
Check the latest chains @rgrunber I also tried to make the label details closer to other completion items. |
21b0924
to
e55ebc3
Compare
@rgrunber when will you be able toe check the latest changes ? |
I think it's just a matter of getting rid of duplicates, and cleaning up how the return value is displayed (unnecessary I'm not sure why there are duplicates though. The example above comes from a testcase in JDT where we assert only 1 element is discovered (from the chain completion proposal computer). Update: I think there are duplicates added to |
- Add IJavaElement (IMethod/IField) to data object of CompletionItem for computation at a later point - Set default chain completion preferences - Update target platform to 4.28-I-builds - React to change in StringConcatToTextBlockFixCore API Signed-off-by: Roland Grunberg <rgrunber@redhat.com>
- add new configuration to enable chain completions - add support for static chain completions for provided know types
- Exclude primitives and boxed primitives - Exclude String and Object types - Update default chain preferences for better suggestions
- add support for snippet - add support for variable names
- fix label and details - handle duplicates
|
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.
Change works well so I'm going to merge. In addition it's disabled so at least it if there's anything we missed, it won't be a problem by deafult.
Just one thing I noticed. I took a project like https://github.com/eclipse/lemminx/blob/main/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/XMLLanguageServer.java#L129C5-L129C73 and wanted to show that the suggestion would be made for something like ExtendedClientCapabilities cap = |
, but i couldn't see the suggestion until I increased the chain completion timeout setting.
I think in the future we should look at how we prioritize the entry points, perhaps choosing local variables before static types.
I can improve it @rgrunber. Will push a new PR during next few days or next week. |
Bring chain completions support to JDT.LS which was started by @rgrunber. I clean it up a little bit and add
Collectors
as a POC. The idea is to improve the this to read from a simple model file where either Microsoft IntelliCore (cc: @jdneo @testforstephen) can provide or any other interested extension provider. We need to discuss the best way to provide this as a extension point for providing model information (cc: @rgrunber @mickaelistria @fbricon )