]> git.eshelyaron.com Git - emacs.git/commitdiff
Survive hover responses with empty markdown strings
authorJoão Távora <joaotavora@gmail.com>
Sun, 3 May 2020 20:37:42 +0000 (21:37 +0100)
committerJoão Távora <joaotavora@gmail.com>
Sun, 3 May 2020 20:37:42 +0000 (21:37 +0100)
* eglot.el (eglot-help-at-point): Protect against null eglot--hover-info

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/433

lisp/progmodes/eglot.el

index 8fadd5f7ab360a1f1c3af48d74172db0e257940c..d172f4c7cc861df05e6f17b61d334cb5a3de0d79 100644 (file)
@@ -2255,15 +2255,16 @@ is not active."
   (eglot--dbind ((Hover) contents range)
       (jsonrpc-request (eglot--current-server-or-lose) :textDocument/hover
                        (eglot--TextDocumentPositionParams))
-    (if (seq-empty-p contents)
-        (display-local-help)
-      (let ((blurb (eglot--hover-info contents range))
-            (sym (thing-at-point 'symbol)))
-        (with-current-buffer (eglot--help-buffer)
-          (with-help-window (current-buffer)
-            (rename-buffer (format "*eglot-help for %s*" sym))
-            (with-current-buffer standard-output (insert blurb))
-            (setq-local nobreak-char-display nil)))))))
+    (let ((blurb (and (not (seq-empty-p contents))
+                      (eglot--hover-info contents range))))
+      (if blurb
+          (with-current-buffer (eglot--help-buffer)
+            (with-help-window (current-buffer)
+              (rename-buffer (format "*eglot-help for %s*"
+                                     (thing-at-point 'symbol)))
+              (with-current-buffer standard-output (insert blurb))
+              (setq-local nobreak-char-display nil)))
+        (display-local-help)))))
 
 (defun eglot-doc-too-large-for-echo-area (string)
   "Return non-nil if STRING won't fit in echo area.