From: João Távora Date: Tue, 8 May 2018 00:46:30 +0000 (+0100) Subject: Try to fix some textdocument/completion bugs X-Git-Tag: emacs-29.0.90~1616^2~524^2~4^2~614 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=378a8371d289696ddf614e8b37a76358b16b418d;p=emacs.git Try to fix some textdocument/completion bugs * eglot.el (eglot-completion-at-point): Rework slightly. --- diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index d7ea32977f8..2e409ef840f 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -1274,13 +1274,13 @@ DUMMY is ignored" (defun eglot-completion-at-point () "EGLOT's `completion-at-point' function." - (let ((bounds (bounds-of-thing-at-point 'sexp)) + (let ((bounds (bounds-of-thing-at-point 'symbol)) (proc (eglot--current-process-or-lose))) (when (eglot--server-capable :completionProvider) (list (or (car bounds) (point)) (or (cdr bounds) (point)) - (completion-table-dynamic + (completion-table-with-cache (lambda (_ignored) (let* ((resp (eglot--sync-request proc @@ -1291,19 +1291,17 @@ DUMMY is ignored" (items (if (vectorp resp) resp (plist-get resp :items)))) (eglot--mapply (eglot--lambda (&key insertText label kind detail - documentation sortText) - (propertize insertText - :label label :kind kind :detail detail + documentation sortText &allow-other-keys) + (propertize (or insertText label) + :kind-name (cdr (assoc kind eglot--kind-names)) + :detail detail :documentation documentation :sortText sortText)) items)))) :annotation-function (lambda (what) (let ((detail (get-text-property 0 :detail what)) - (kind (get-text-property 0 :kind what))) - (format "%s%s" - detail - (if kind - (format " (%s)" (cdr (assoc kind eglot--kind-names))) - "")))) + (kind-name (get-text-property 0 :kind what))) + (concat (if detail (format " %s" detail) "") + (if kind-name (format " (%s)" kind-name) "")))) :display-sort-function (lambda (items) (sort items (lambda (a b) (string-lessp