Skip to content
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

JDT completions coming from LS application fixed #908

Merged
merged 3 commits into from Feb 7, 2024

Conversation

BoykoAlex
Copy link
Contributor

No description provided.

Copy link
Contributor

@martinlippert martinlippert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this locally and this fix breaks #881 (after applying such a proposal, the linked editing mode doesn't come up). So this would need to change https://github.com/eclipse/lsp4e/blob/master/org.eclipse.lsp4e.jdt/src/org/eclipse/lsp4e/jdt/LSJavaCompletionProposalComputer.java#L87 so that it creates the LSJavaProposalExtension2 in your fix.

But I am wondering why LSJavaProposal can't implement all the necessary extension interfaces, much like LSCompletionProposal (the actual delegate) instead of having different subclasses for each?

@BoykoAlex
Copy link
Contributor Author

It might wrap org.eclipse.lsp4e.operations.codeactions.CodeActionCompletionProposal which does not implement any completion extension interfaces. The apply method for such proposal needs only the document as a parameter.
Now extension 1 and 2 have an alternative "apply" method that takes a number of different parameters (viewr, doc, offset, trigger chat etc.). Looking at org.eclipse.jface.text.contentassist.CompletionProposalPopup line 997 suggests that we need wrappers for each extension that has diferent apply logic.
The issue is that code action comes as CodeActionCompletionProposal which when wrapped suddenly implements extension 2 and applied differently. We could keep LSJavaProposal only without the extensions and have its apply method with cases like in CompletionProposalPopup line 997, i.e getting doc from the viewer though seems a bit risky as doc comes from the context rather than viewer in the proposal popup logic...

Copy link
Contributor Author

@BoykoAlex BoykoAlex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added the missing bit in the latest commit

@BoykoAlex BoykoAlex self-assigned this Feb 6, 2024
@BoykoAlex
Copy link
Contributor Author

@mickaelistria am I okay to merge this once @martinlippert approves?

Copy link
Contributor

@martinlippert martinlippert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me for the moment, all my tests were successful. I am still not convinced that the different wrapper implementations are really necessary here, so would like to review these changes in a future step to dive into the details here a bit. But first, let's merge this to move forward here.

@martinlippert martinlippert merged commit d0dd7e3 into eclipse:master Feb 7, 2024
2 checks passed
@martinlippert
Copy link
Contributor

@mickaelistria am I okay to merge this once @martinlippert approves?

Based on your previous comment @mickaelistria , I decided to merge this after successful testing on my side. Hope that is fine with you... :-)

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.

None yet

2 participants