Skip to content

Commit

Permalink
Fix check of capability of resolve inlay hint.
Browse files Browse the repository at this point in the history
Signed-off-by: azerr <azerr@redhat.com>
  • Loading branch information
angelozerr authored and mickaelistria committed Sep 2, 2022
1 parent b7656e7 commit 75a9374
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.eclipse.lsp4e.LanguageServiceAccessor;
import org.eclipse.lsp4j.InlayHint;
import org.eclipse.lsp4j.InlayHintLabelPart;
import org.eclipse.lsp4j.InlayHintRegistrationOptions;
import org.eclipse.lsp4j.Position;
import org.eclipse.lsp4j.ServerCapabilities;
import org.eclipse.lsp4j.jsonrpc.messages.Either;
Expand Down Expand Up @@ -68,7 +69,12 @@ protected CompletableFuture<Void> doResolve(ITextViewer viewer, IProgressMonitor
}

private static boolean canResolveInlayHint(ServerCapabilities capabilities) {
return capabilities.getInlayHintProvider().map(Function.identity(), (r) -> r.getResolveProvider());
Either<Boolean, InlayHintRegistrationOptions> inlayProvider = capabilities.getInlayHintProvider();
if (inlayProvider != null && inlayProvider.isRight()) {
InlayHintRegistrationOptions options = inlayProvider.getRight();
return options.getResolveProvider() != null && options.getResolveProvider().booleanValue();
}
return false;
}

/**
Expand Down

0 comments on commit 75a9374

Please sign in to comment.