From 7361713e9b3cb46b4ede723a5b94761be5b12df5 Mon Sep 17 00:00:00 2001 From: aboyko Date: Fri, 20 Oct 2023 15:26:13 -0400 Subject: [PATCH] Properly implement IJavaCompletionProposal --- .../boot/ls/markers/DelegateMarkerResolution.java | 13 ++++++++----- .../markers/LSPBootCodeActionMarkerResolution.java | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/eclipse-language-servers/org.springframework.tooling.boot.ls/src/org/springframework/tooling/boot/ls/markers/DelegateMarkerResolution.java b/eclipse-language-servers/org.springframework.tooling.boot.ls/src/org/springframework/tooling/boot/ls/markers/DelegateMarkerResolution.java index 57ac5bf9ff..48c71a6ffc 100644 --- a/eclipse-language-servers/org.springframework.tooling.boot.ls/src/org/springframework/tooling/boot/ls/markers/DelegateMarkerResolution.java +++ b/eclipse-language-servers/org.springframework.tooling.boot.ls/src/org/springframework/tooling/boot/ls/markers/DelegateMarkerResolution.java @@ -25,8 +25,11 @@ public class DelegateMarkerResolution implements IMarkerResolution, IMarkerResol final private IMarkerResolution delegate; final private int relevance; + + final private IMarker marker; - public DelegateMarkerResolution(IMarkerResolution res, int relevance) { + public DelegateMarkerResolution(IMarker marker, IMarkerResolution res, int relevance) { + this.marker = marker; this.delegate = res; this.relevance = relevance; } @@ -43,12 +46,12 @@ public void run(IMarker marker) { @Override public void apply(IDocument document) { - throw new UnsupportedOperationException(); + delegate.run(marker); } @Override public Point getSelection(IDocument document) { - throw new UnsupportedOperationException(); + return null; } @Override @@ -58,7 +61,7 @@ public String getAdditionalProposalInfo() { @Override public String getDisplayString() { - return getLabel(); + return delegate.getLabel(); } @Override @@ -68,7 +71,7 @@ public Image getImage() { @Override public IContextInformation getContextInformation() { - throw new UnsupportedOperationException(); + return null; } @Override diff --git a/eclipse-language-servers/org.springframework.tooling.boot.ls/src/org/springframework/tooling/boot/ls/markers/LSPBootCodeActionMarkerResolution.java b/eclipse-language-servers/org.springframework.tooling.boot.ls/src/org/springframework/tooling/boot/ls/markers/LSPBootCodeActionMarkerResolution.java index f9282d944e..2e0750525b 100644 --- a/eclipse-language-servers/org.springframework.tooling.boot.ls/src/org/springframework/tooling/boot/ls/markers/LSPBootCodeActionMarkerResolution.java +++ b/eclipse-language-servers/org.springframework.tooling.boot.ls/src/org/springframework/tooling/boot/ls/markers/LSPBootCodeActionMarkerResolution.java @@ -23,7 +23,7 @@ public class LSPBootCodeActionMarkerResolution extends LSPCodeActionMarkerResolu public IMarkerResolution[] getResolutions(IMarker marker) { IMarkerResolution[] res = super.getResolutions(marker); AtomicInteger relevance = new AtomicInteger(res.length); - return Arrays.stream(res).map(r -> new DelegateMarkerResolution(r, relevance.getAndDecrement())) + return Arrays.stream(res).map(r -> new DelegateMarkerResolution(marker, r, relevance.getAndDecrement())) .toArray(IMarkerResolution[]::new); }