From c8ea2c269a5452753875482a06f0de59b576dd96 Mon Sep 17 00:00:00 2001 From: Xu Chunyang <4550353+xuchunyang@users.noreply.github.com> Date: Mon, 28 Oct 2019 23:29:03 +0800 Subject: [PATCH] Support markdown for textdocument/hover () * eglot.el (eglot-client-capabilities): annouce markdown support for hover. (eglot--format-markup): Format hover info with Markdown. Fixes: https://github.com/joaotavora/eglot/issues/328 Copyright-paperwork-exempt: yes GitHub-reference: https://github.com/joaotavora/eglot/issues/329 --- lisp/progmodes/eglot.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 285dc50ac84..1f7a396ef98 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -489,7 +489,8 @@ treated as in `eglot-dbind'." t :json-false)) :contextSupport t) - :hover `(:dynamicRegistration :json-false) + :hover (list :dynamicRegistration :json-false + :contentFormat ["markdown" "plaintext"]) :signatureHelp (list :dynamicRegistration :json-false :signatureInformation `(:parameterInformation @@ -1080,7 +1081,9 @@ Doubles as an indicator of snippet support." (if (stringp markup) (list (string-trim markup) (intern "gfm-view-mode")) (list (plist-get markup :value) - major-mode)))) + (pcase (plist-get markup :kind) + ("markdown" 'gfm-view-mode) + (_ major-mode)))))) (with-temp-buffer (insert string) (ignore-errors (delay-mode-hooks (funcall mode))) -- 2.39.2