summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Yonchovski <yyoncho@gmail.com>2020-03-07 11:13:10 +0200
committerbrotzeit <brotzeitmacher@gmail.com>2020-03-07 11:07:03 +0100
commitbb4a2f0915ccb074878d512d741df4a0fa458ead (patch)
treee9bf7236c0d2f3d5e2da9c27c749da00759f2705
parent7d23fd405e9e45056bd07deb253bc161719b8b1d (diff)
Add cancel tokens for lsp-ui requests
- the fact that we are not sending cancel tokens is causing troubles to some of the language servers(e. g. clangd).
-rw-r--r--lsp-ui-doc.el9
-rw-r--r--lsp-ui-sideline.el3
-rw-r--r--lsp-ui.el5
3 files changed, 10 insertions, 7 deletions
diff --git a/lsp-ui-doc.el b/lsp-ui-doc.el
index a5fc12c..77378c1 100644
--- a/lsp-ui-doc.el
+++ b/lsp-ui-doc.el
@@ -679,11 +679,14 @@ HEIGHT is the documentation number of lines."
(let ((buf (current-buffer)))
(lambda nil
(when (equal buf (current-buffer))
- (lsp--send-request-async
- (lsp--make-request "textDocument/hover" (lsp--text-document-position-params))
+ (lsp-request-async
+ "textDocument/hover"
+ (lsp--text-document-position-params)
(lambda (hover)
(when (equal buf (current-buffer))
- (lsp-ui-doc--callback hover bounds (current-buffer)))))))))))
+ (lsp-ui-doc--callback hover bounds (current-buffer))))
+ :mode 'tick
+ :cancel-token :lsp-ui-doc-hover)))))))
(lsp-ui-doc--hide-frame))))
(defun lsp-ui-doc--callback (hover bounds buffer)
diff --git a/lsp-ui-sideline.el b/lsp-ui-sideline.el
index b98dc53..6eb9457 100644
--- a/lsp-ui-sideline.el
+++ b/lsp-ui-sideline.el
@@ -449,7 +449,8 @@ from the language server."
:context (list :diagnostics (lsp-cur-line-diagnostics)))
(lsp--text-document-code-action-params))
(lambda (actions) (lsp-ui-sideline--code-actions actions bol eol))
- :mode 'alive))
+ :mode 'alive
+ :cancel-token :lsp-ui-code-actions))
;; Go through all symbols and request hover information. Note that the symbols are
;; traversed backwards as `forward-symbol' with a positive argument will jump just past the
;; current symbol. By going from the end of the line towards the front, point will be placed
diff --git a/lsp-ui.el b/lsp-ui.el
index 91a4421..4daecdf 100644
--- a/lsp-ui.el
+++ b/lsp-ui.el
@@ -120,9 +120,8 @@ Both should have the form (FILENAME LINE COLUMN)."
(defun lsp-ui--reference-triples (extra)
"Return references as a list of (FILENAME LINE COLUMN) triples."
- (let ((refs (lsp--send-request (lsp--make-request
- "textDocument/references"
- (append (lsp--text-document-position-params) extra)))))
+ (let ((refs (lsp-request "textDocument/references"
+ (append (lsp--text-document-position-params) extra))))
(sort
(mapcar
(lambda (ref)