eclipse / lsp4e

Language Server Protocol support in Eclipse IDE
Eclipse Public License 2.0
65 stars 54 forks source link

JDT completions coming from LS application fixed #908

Closed BoykoAlex closed 8 months ago

BoykoAlex commented 8 months ago

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...

BoykoAlex commented 8 months ago

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

martinlippert commented 8 months ago

@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... :-)