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.
This commit is contained in:
João Távora 2023-03-23 17:34:46 +00:00
parent 67c1e6e89c
commit fe8af4eb30

View file

@ -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")