Skip to content

Commit

Permalink
Adopt the new lsp4j 0.9.0 bits to fix build errors
Browse files Browse the repository at this point in the history
Signed-off-by: Jinbo Wang <[email protected]>
  • Loading branch information
testforstephen authored and fbricon committed Feb 21, 2020
1 parent a1deb28 commit 9eb5a29
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
import org.eclipse.lsp4j.CompletionItem;
import org.eclipse.lsp4j.CompletionList;
import org.eclipse.lsp4j.CompletionParams;
import org.eclipse.lsp4j.DefinitionParams;
import org.eclipse.lsp4j.DidChangeConfigurationParams;
import org.eclipse.lsp4j.DidChangeTextDocumentParams;
import org.eclipse.lsp4j.DidChangeWatchedFilesParams;
Expand All @@ -100,6 +101,7 @@
import org.eclipse.lsp4j.DidSaveTextDocumentParams;
import org.eclipse.lsp4j.DocumentFormattingParams;
import org.eclipse.lsp4j.DocumentHighlight;
import org.eclipse.lsp4j.DocumentHighlightParams;
import org.eclipse.lsp4j.DocumentOnTypeFormattingOptions;
import org.eclipse.lsp4j.DocumentOnTypeFormattingParams;
import org.eclipse.lsp4j.DocumentRangeFormattingParams;
Expand All @@ -110,11 +112,14 @@
import org.eclipse.lsp4j.FoldingRange;
import org.eclipse.lsp4j.FoldingRangeRequestParams;
import org.eclipse.lsp4j.Hover;
import org.eclipse.lsp4j.HoverParams;
import org.eclipse.lsp4j.ImplementationParams;
import org.eclipse.lsp4j.InitializeParams;
import org.eclipse.lsp4j.InitializeResult;
import org.eclipse.lsp4j.InitializedParams;
import org.eclipse.lsp4j.Location;
import org.eclipse.lsp4j.LocationLink;
import org.eclipse.lsp4j.PrepareRenameParams;
import org.eclipse.lsp4j.PrepareRenameResult;
import org.eclipse.lsp4j.Range;
import org.eclipse.lsp4j.ReferenceParams;
Expand All @@ -129,6 +134,7 @@
import org.eclipse.lsp4j.TextDocumentIdentifier;
import org.eclipse.lsp4j.TextDocumentPositionParams;
import org.eclipse.lsp4j.TextEdit;
import org.eclipse.lsp4j.TypeDefinitionParams;
import org.eclipse.lsp4j.Unregistration;
import org.eclipse.lsp4j.UnregistrationParams;
import org.eclipse.lsp4j.WillSaveTextDocumentParams;
Expand Down Expand Up @@ -526,10 +532,10 @@ public CompletableFuture<CompletionItem> resolveCompletionItem(CompletionItem un
}

/* (non-Javadoc)
* @see org.eclipse.lsp4j.services.TextDocumentService#hover(org.eclipse.lsp4j.TextDocumentPositionParams)
* @see org.eclipse.lsp4j.services.TextDocumentService#hover(org.eclipse.lsp4j.HoverParams)
*/
@Override
public CompletableFuture<Hover> hover(TextDocumentPositionParams position) {
public CompletableFuture<Hover> hover(HoverParams position) {
logInfo(">> document/hover");
HoverHandler handler = new HoverHandler(this.preferenceManager);
return computeAsync((monitor) -> handler.hover(position, monitor));
Expand All @@ -546,10 +552,10 @@ public CompletableFuture<SignatureHelp> signatureHelp(SignatureHelpParams positi
}

/* (non-Javadoc)
* @see org.eclipse.lsp4j.services.TextDocumentService#definition(org.eclipse.lsp4j.TextDocumentPositionParams)
* @see org.eclipse.lsp4j.services.TextDocumentService#definition(org.eclipse.lsp4j.DefinitionParams)
*/
@Override
public CompletableFuture<Either<List<? extends Location>, List<? extends LocationLink>>> definition(TextDocumentPositionParams position) {
public CompletableFuture<Either<List<? extends Location>, List<? extends LocationLink>>> definition(DefinitionParams position) {
logInfo(">> document/definition");
NavigateToDefinitionHandler handler = new NavigateToDefinitionHandler(this.preferenceManager);
return computeAsync((monitor) -> {
Expand All @@ -559,10 +565,10 @@ public CompletableFuture<Either<List<? extends Location>, List<? extends Locatio
}

/* (non-Javadoc)
* @see org.eclipse.lsp4j.services.TextDocumentService#typeDefinition(org.eclipse.lsp4j.TextDocumentPositionParams)
* @see org.eclipse.lsp4j.services.TextDocumentService#typeDefinition(org.eclipse.lsp4j.TypeDefinitionParams)
*/
@Override
public CompletableFuture<Either<List<? extends Location>, List<? extends LocationLink>>> typeDefinition(TextDocumentPositionParams position) {
public CompletableFuture<Either<List<? extends Location>, List<? extends LocationLink>>> typeDefinition(TypeDefinitionParams position) {
logInfo(">> document/typeDefinition");
NavigateToTypeDefinitionHandler handler = new NavigateToTypeDefinitionHandler();
return computeAsync((monitor) -> {
Expand All @@ -588,10 +594,10 @@ public CompletableFuture<List<? extends Location>> findLinks(FindLinksParams par
}

/* (non-Javadoc)
* @see org.eclipse.lsp4j.services.TextDocumentService#documentHighlight(org.eclipse.lsp4j.TextDocumentPositionParams)
* @see org.eclipse.lsp4j.services.TextDocumentService#documentHighlight(org.eclipse.lsp4j.DocumentHighlightParams)
*/
@Override
public CompletableFuture<List<? extends DocumentHighlight>> documentHighlight(TextDocumentPositionParams position) {
public CompletableFuture<List<? extends DocumentHighlight>> documentHighlight(DocumentHighlightParams position) {
logInfo(">> document/documentHighlight");
DocumentHighlightHandler handler = new DocumentHighlightHandler();
return computeAsync((monitor) -> handler.documentHighlight(position, monitor));
Expand Down Expand Up @@ -681,10 +687,10 @@ public CompletableFuture<List<? extends TextEdit>> onTypeFormatting(DocumentOnTy
}

/* (non-Javadoc)
* @see org.eclipse.lsp4j.services.TextDocumentService#prepareRename(org.eclipse.lsp4j.TextDocumentPositionParams)
* @see org.eclipse.lsp4j.services.TextDocumentService#prepareRename(org.eclipse.lsp4j.PrepareRenameParams)
*/
@Override
public CompletableFuture<Either<Range, PrepareRenameResult>> prepareRename(TextDocumentPositionParams params) {
public CompletableFuture<Either<Range, PrepareRenameResult>> prepareRename(PrepareRenameParams params) {
logInfo(">> document/prepareRename");

PrepareRenameHandler handler = new PrepareRenameHandler();
Expand Down Expand Up @@ -789,7 +795,7 @@ public void didChangeWorkspaceFolders(DidChangeWorkspaceFoldersParams params) {
}

@Override
public CompletableFuture<Either<List<? extends Location>, List<? extends LocationLink>>> implementation(TextDocumentPositionParams position) {
public CompletableFuture<Either<List<? extends Location>, List<? extends LocationLink>>> implementation(ImplementationParams position) {
logInfo(">> document/implementation");
return computeAsyncWithClientProgress((monitor) -> {
ImplementationsHandler handler = new ImplementationsHandler(preferenceManager);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@
import java.util.Map;

import org.eclipse.lsp4j.ClientCapabilities;
import org.eclipse.lsp4j.DiagnosticsTagSupport;
import org.eclipse.lsp4j.DynamicRegistrationCapabilities;
import org.eclipse.lsp4j.MarkupKind;
import org.eclipse.lsp4j.ResourceOperationKind;
import org.eclipse.lsp4j.jsonrpc.messages.Either;

/**
* A wrapper around {@link ClientCapabilities}
Expand Down Expand Up @@ -287,10 +289,14 @@ public boolean isDiagnosticTagSupported() {
//@formatter:off
return v3supported && capabilities.getTextDocument().getPublishDiagnostics() != null
&& capabilities.getTextDocument().getPublishDiagnostics().getTagSupport() != null
&& capabilities.getTextDocument().getPublishDiagnostics().getTagSupport().getValueSet() != null;
&& isTagSupported(capabilities.getTextDocument().getPublishDiagnostics().getTagSupport());
//@formatter:on
}

private boolean isTagSupported(Either<Boolean, DiagnosticsTagSupport> tagSupport) {
return tagSupport.isLeft() ? tagSupport.getLeft() : tagSupport.getRight().getValueSet() != null;
}

public boolean isCallHierarchyDynamicRegistered() {
return v3supported && isDynamicRegistrationSupported(capabilities.getTextDocument().getCallHierarchy());
}
Expand Down

0 comments on commit 9eb5a29

Please sign in to comment.