Properly implement IJavaCompletionProposal

This commit is contained in:
aboyko
2023-10-20 15:26:13 -04:00
parent 31e3667ad1
commit 7361713e9b
2 changed files with 9 additions and 6 deletions

View File

@@ -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 class DelegateMarkerResolution implements IMarkerResolution, IMarkerResol
@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 class DelegateMarkerResolution implements IMarkerResolution, IMarkerResol
@Override
public String getDisplayString() {
return getLabel();
return delegate.getLabel();
}
@Override
@@ -68,7 +71,7 @@ public class DelegateMarkerResolution implements IMarkerResolution, IMarkerResol
@Override
public IContextInformation getContextInformation() {
throw new UnsupportedOperationException();
return null;
}
@Override

View File

@@ -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);
}