]> git.eshelyaron.com Git - emacs.git/commitdiff
Support markdown for textdocument/hover ()
authorXu Chunyang <4550353+xuchunyang@users.noreply.github.com>
Mon, 28 Oct 2019 15:29:03 +0000 (23:29 +0800)
committerJoão Távora <joaotavora@gmail.com>
Mon, 28 Oct 2019 15:29:03 +0000 (15:29 +0000)
* 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

index 285dc50ac849f69d204d4939584b7ef000264858..1f7a396ef980cb48563e968dc7e904da9bf23281 100644 (file)
@@ -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)))