emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master fe8af4eb30b 6/7: Eglot: don't send invisible text to Eldoc


From: João Távora
Subject: master fe8af4eb30b 6/7: Eglot: don't send invisible text to Eldoc
Date: Thu, 23 Mar 2023 17:17:42 -0400 (EDT)

branch: master
commit fe8af4eb30b81d34bea3f3d982a9167acc8e19e1
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    Eglot: don't send invisible text to Eldoc
    
    Eglot's rendering of Markdown is imperfect and based on gfm-view-mode.
    To make it slightly better, don't send invisible text in
    eglot-hover-eldoc-function.
    
    * lisp/progmodes/eglot.el (eglot--format-markup): Hide invisible text.
---
 lisp/progmodes/eglot.el | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 919f44a2d9a..fae1c8db8b7 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -1653,10 +1653,15 @@ Doubles as an indicator of snippet support."
       (setq-local markdown-fontify-code-blocks-natively t)
       (insert string)
       (let ((inhibit-message t)
-            (message-log-max nil))
-        (ignore-errors (delay-mode-hooks (funcall mode))))
-      (font-lock-ensure)
-      (string-trim (buffer-string)))))
+            (message-log-max nil)
+            match)
+        (ignore-errors (delay-mode-hooks (funcall mode)))
+        (font-lock-ensure)
+        (goto-char (point-min))
+        (while (setq match (text-property-search-forward 'invisible))
+          (delete-region (prop-match-beginning match)
+                         (prop-match-end match)))
+        (string-trim (buffer-string))))))
 
 (define-obsolete-variable-alias 'eglot-ignored-server-capabilites
   'eglot-ignored-server-capabilities "1.8")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]