summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeigh McCulloch <leigh@mcchouse.com>2019-03-06 07:21:12 +0000
committerLeigh McCulloch <leigh@mcchouse.com>2019-03-06 07:21:12 +0000
commit1a08b3120ce8285180ec42c9656040fc9981078c (patch)
treec35035b6772efd3723574e5eb1fae83658d81ebc
parent6506f8ff47385f04d5f6f3ca47538405f5e77b47 (diff)
downloadjava-language-server-1a08b3120ce8285180ec42c9656040fc9981078c.zip
Only include docs if they are not blank
Sometimes the docs are present but an empty string. Lets not add it unless there's actually text to add. This presents the data a little better to clients since clients don't get an empty MarkedString.
-rw-r--r--src/main/java/org/javacs/JavaLanguageServer.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main/java/org/javacs/JavaLanguageServer.java b/src/main/java/org/javacs/JavaLanguageServer.java
index 9d5b33d..cbe92d0 100644
--- a/src/main/java/org/javacs/JavaLanguageServer.java
+++ b/src/main/java/org/javacs/JavaLanguageServer.java
@@ -32,6 +32,7 @@ import java.util.Optional;
import java.util.Set;
import java.util.StringJoiner;
import java.util.UUID;
+import java.util.function.Predicate;
import java.util.logging.Logger;
import javax.lang.model.element.Element;
import javax.lang.model.element.ExecutableElement;
@@ -645,9 +646,9 @@ class JavaLanguageServer extends LanguageServer {
// Add docs hover message
var docs = hoverDocs(el.get());
- if (docs.isPresent()) {
- result.add(new MarkedString(docs.get()));
- }
+ docs.filter(Predicate.not(String::isBlank)).ifPresent(doc -> {
+ result.add(new MarkedString(doc));
+ });
// Add code hover message
var code = hoverCode(el.get());