Skip to content

Commit

Permalink
Close joaotavora#61: Snappier completions that don't hinder typing
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
joaotavora committed Aug 10, 2018
1 parent a62c2da commit fdd021c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions eglot.el
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
;; Maintainer: João Távora <joaotavora@gmail.com>
;; 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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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*")
Expand Down

0 comments on commit fdd021c

Please sign in to comment.