From ad701795985377401eb007a2eeb5ece65d47b0dc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Mon, 13 Jul 2020 23:59:41 +0100 Subject: [PATCH] Use a hash-table for storing resolved completions * eglot.el (eglot-completion-at-point): use a hash-table for storing resolved completions. GitHub-reference: fix https://github.com/joaotavora/eglot/issues/510 --- lisp/progmodes/eglot.el | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 865ca03dd32..c0f3143ba14 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -2103,20 +2103,20 @@ is not active." (put-text-property 0 1 'eglot--lsp-item item proxy)) proxy)) items))))) - resolved + (resolved (make-hash-table)) (resolve-maybe ;; Maybe completion/resolve JSON object `lsp-comp' into ;; another JSON object, if at all possible. Otherwise, ;; just return lsp-comp. (lambda (lsp-comp) - (cond (resolved resolved) - ((and (eglot--server-capable :completionProvider - :resolveProvider) - (plist-get lsp-comp :data)) - (setq resolved - (jsonrpc-request server :completionItem/resolve - lsp-comp :cancel-on-input t))) - (t lsp-comp)))) + (or (gethash lsp-comp resolved) + (setf (gethash lsp-comp resolved) + (if (and (eglot--server-capable :completionProvider + :resolveProvider) + (plist-get lsp-comp :data)) + (jsonrpc-request server :completionItem/resolve + lsp-comp :cancel-on-input t) + lsp-comp))))) (bounds (bounds-of-thing-at-point 'symbol))) (list (or (car bounds) (point)) -- 2.39.2