diff --git a/headless-services/commons/commons-language-server/src/main/java/org/springframework/ide/vscode/commons/languageserver/util/SimpleTextDocumentService.java b/headless-services/commons/commons-language-server/src/main/java/org/springframework/ide/vscode/commons/languageserver/util/SimpleTextDocumentService.java index 212d0ec1b..4f6f86092 100644 --- a/headless-services/commons/commons-language-server/src/main/java/org/springframework/ide/vscode/commons/languageserver/util/SimpleTextDocumentService.java +++ b/headless-services/commons/commons-language-server/src/main/java/org/springframework/ide/vscode/commons/languageserver/util/SimpleTextDocumentService.java @@ -363,10 +363,16 @@ public class SimpleTextDocumentService implements TextDocumentService, DocumentE return async.invoke(() -> { List 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()));