]> git.eshelyaron.com Git - emacs.git/commitdiff
Support autoimporttext from pyright language server
authorFredrik Bergroth <fbergroth@gmail.com>
Wed, 15 Dec 2021 12:05:22 +0000 (13:05 +0100)
committerStefan Kangas <stefankangas@gmail.com>
Tue, 11 Jan 2022 03:05:36 +0000 (04:05 +0100)
* eglot.el (eglot-completion-at-point): show autoImportText via company-docsig.

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/769

lisp/progmodes/eglot.el

index 85220f2cd52f4e632885ab0f3c840812e4e57883..80eb58f57914b8c18a5a063de3211f0910f685fb 100644 (file)
@@ -2416,6 +2416,13 @@ is not active."
                      (kind (alist-get (plist-get lsp-item :kind)
                                       eglot--kind-names)))
            (intern (downcase kind))))
+       :company-docsig
+       ;; FIXME: autoImportText is specific to the pyright language server
+       (lambda (proxy)
+         (when-let* ((lsp-comp (get-text-property 0 'eglot--lsp-item proxy))
+                     (data (plist-get (funcall resolve-maybe lsp-comp) :data))
+                     (import-text (plist-get data :autoImportText)))
+           import-text))
        :company-doc-buffer
        (lambda (proxy)
          (let* ((documentation