]> git.eshelyaron.com Git - emacs.git/commitdiff
Add :company-kind to eglot-completion-at-point
authorMohsin Kaleem <mohkale@kisara.moe>
Mon, 29 Mar 2021 21:32:33 +0000 (22:32 +0100)
committerMohsin Kaleem <mohkale@kisara.moe>
Mon, 12 Apr 2021 23:25:27 +0000 (00:25 +0100)
* eglot.el (eglot-completion-at-point): Add a :company-kind field to the
completion-at-point function so that company can associate completion
candidates with lsp types.

GitHub-reference: close https://github.com/joaotavora/eglot/issues/652

lisp/progmodes/eglot.el

index 5914f2ddd4721a100eef9ca2b9f6734be5cd3e8d..579ed27913e62f1959831c1b5ccefd4521e3eaa2 100644 (file)
@@ -2236,6 +2236,13 @@ is not active."
                (concat " "
                        (propertize annotation
                                    'face 'font-lock-function-name-face))))))
+       :company-kind
+       ;; Associate each lsp-item with a lsp-kind symbol.
+       (lambda (proxy)
+         (when-let* ((lsp-item (get-text-property 0 'eglot--lsp-item proxy))
+                     (kind (alist-get (plist-get lsp-item :kind)
+                                      eglot--kind-names)))
+           (intern (downcase kind))))
        :company-doc-buffer
        (lambda (proxy)
          (let* ((documentation