textDocument/definition should not send 'null' result

See: https://github.com/spring-projects/sts4/issues/309
This commit is contained in:
Kris De Volder
2019-06-24 11:11:01 -07:00
parent 3a992f43cf
commit cd873229b6

View File

@@ -352,7 +352,11 @@ public class SimpleTextDocumentService implements TextDocumentService, DocumentE
if (h != null) {
return async.invoke(() -> {
List<Location> locations = h.handle(position);
return Either.<List<? extends Location>, List<? extends LocationLink>>forLeft(locations);
if (locations==null) {
// vscode client does not like to recieve null result. See: https://github.com/spring-projects/sts4/issues/309
locations = ImmutableList.of();
}
return Either.forLeft(locations);
});
}
return CompletableFuture.completedFuture(Either.forLeft(ImmutableList.of()));