LS sends Location for Theia client instead of LocationLink

This commit is contained in:
BoykoAlex
2019-10-17 19:03:49 -04:00
parent 44db867715
commit 3a4efe9c97

View File

@@ -363,10 +363,16 @@ public class SimpleTextDocumentService implements TextDocumentService, DocumentE
return async.invoke(() -> {
List<LocationLink> locations = h.handle(position);
if (locations==null) {
// vscode client does not like to recieve null result. See: https://github.com/spring-projects/sts4/issues/309
// vscode client does not like to receive null result. See: https://github.com/spring-projects/sts4/issues/309
locations = ImmutableList.of();
}
return Either.forRight(locations);
// Workaround for https://github.com/eclipse-theia/theia/issues/6414
// Theia does not support LocationLink yet
if (LspClient.currentClient() == LspClient.Client.THEIA) {
return Either.forLeft(locations.stream().map(link -> new Location(link.getTargetUri(), link.getTargetRange())).collect(Collectors.toList()));
} else {
return Either.forRight(locations);
}
});
}
return CompletableFuture.completedFuture(Either.forLeft(ImmutableList.of()));