Skip to content

Commit

Permalink
Properly implement IJavaCompletionProposal
Browse files Browse the repository at this point in the history
  • Loading branch information
BoykoAlex committed Oct 20, 2023
1 parent 31e3667 commit 7361713
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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
Expand All @@ -58,7 +61,7 @@ public String getAdditionalProposalInfo() {

@Override
public String getDisplayString() {
return getLabel();
return delegate.getLabel();
}

@Override
Expand All @@ -68,7 +71,7 @@ public Image getImage() {

@Override
public IContextInformation getContextInformation() {
throw new UnsupportedOperationException();
return null;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 7361713

Please sign in to comment.