From: João Távora Date: Fri, 10 Aug 2018 00:03:59 +0000 (+0100) Subject: Snappier completions that don't hinder typing X-Git-Tag: emacs-29.0.90~1616^2~524^2~4^2~456 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c61b3624f5a20efaea3ff997d48100917c286ffa;p=emacs.git Snappier completions that don't hinder typing This should improve company-capf's performance. * eglot.el (Package-Requires): Require jsonrpc 1.0,1 (eglot-completion-at-point): Use completion-table-dynamic. Pass CANCEL-ON-INPUT to jsonrpc-request. GitHub-reference: close https://github.com/joaotavora/eglot/issues/61 --- diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index d29bef540cb..9e714163a47 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -7,7 +7,7 @@ ;; Maintainer: João Távora ;; URL: https://github.com/joaotavora/eglot ;; Keywords: convenience, languages -;; Package-Requires: ((emacs "26.1") (jsonrpc "1.0.0")) +;; Package-Requires: ((emacs "26.1") (jsonrpc "1.0.1")) ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -1275,12 +1275,13 @@ is not active." (list (or (car bounds) (point)) (or (cdr bounds) (point)) - (completion-table-with-cache + (completion-table-dynamic (lambda (_ignored) (let* ((resp (jsonrpc-request server :textDocument/completion (eglot--TextDocumentPositionParams) - :deferred :textDocument/completion)) + :deferred :textDocument/completion + :cancel-on-input t)) (items (if (vectorp resp) resp (plist-get resp :items)))) (mapcar (jsonrpc-lambda (&rest all &key label insertText &allow-other-keys) @@ -1317,7 +1318,8 @@ is not active." (plist-get (jsonrpc-request server :completionItem/resolve (get-text-property - 0 'eglot--lsp-completion obj)) + 0 'eglot--lsp-completion obj) + :cancel-on-input t) :documentation))))) (when documentation (with-current-buffer (get-buffer-create " *eglot doc*")