]> git.eshelyaron.com Git - emacs.git/commitdiff
Format documentation in completion annotations
authorRicardo Martins <ricardo@scarybox.net>
Sun, 8 Jul 2018 16:02:32 +0000 (17:02 +0100)
committerJoão Távora <joaotavora@gmail.com>
Sun, 8 Jul 2018 23:29:29 +0000 (00:29 +0100)
Fixes an issue with the latest RLS, where the server returns a plist
instead of a plain string as documentation for completion candidates,
which broke the `annotation-function`. This change was introduced by
https://github.com/rust-lang-nursery/rls/commit/206a9fb41e837333d0e67187a6a9fe24868b77a4

Copyright-paperwork-exempt: yes

* eglot.el (eglot-completion-at-point): Use eglot--format-markup

lisp/progmodes/eglot.el

index fd633388452ebed1e46c9744e3eb325000c81d66..396590f6fd0199b574beaa16f7d7599cc831108a 100644 (file)
@@ -1216,10 +1216,10 @@ DUMMY is ignored."
                  (items (if (vectorp resp) resp (plist-get resp :items))))
             (mapcar
              (jsonrpc-lambda (&rest all &key label insertText &allow-other-keys)
-               (let ((insert (or insertText label)))
-                 (add-text-properties 0 1 all insert)
-                 (put-text-property 0 1 'eglot--lsp-completion all insert)
-                 insert))
+                             (let ((insert (or insertText label)))
+                               (add-text-properties 0 1 all insert)
+                               (put-text-property 0 1 'eglot--lsp-completion all insert)
+                               insert))
              items))))
        :annotation-function
        (lambda (obj)
@@ -1227,7 +1227,8 @@ DUMMY is ignored."
              (text-properties-at 0 obj)
            (let ((annotation
                   (or (and documentation
-                           (replace-regexp-in-string "\n.*" "" documentation))
+                           (replace-regexp-in-string
+                            "\n.*" "" (eglot--format-markup documentation)))
                       detail
                       (cdr (assoc kind eglot--kind-names)))))
              (when annotation