[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eglot ace6fce 07/15: Check capabilities before sending
From: |
João Távora |
Subject: |
[elpa] externals/eglot ace6fce 07/15: Check capabilities before sending :completionItem/resolve |
Date: |
Sun, 20 May 2018 19:59:03 -0400 (EDT) |
branch: externals/eglot
commit ace6fce411e0dc0811875295df8ad4cb98934113
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
Check capabilities before sending :completionItem/resolve
* eglot.el (eglot--server-capable): Rewrite.
(eglot-completion-at-point): Check caps before sending
:completionItem/resolve
---
eglot.el | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/eglot.el b/eglot.el
index e8af7ed..a5c4696 100644
--- a/eglot.el
+++ b/eglot.el
@@ -796,9 +796,16 @@ If optional MARKER, return a marker instead"
(font-lock-ensure)
(buffer-string)))))
-(defun eglot--server-capable (feat)
- "Determine if current server is capable of FEAT."
- (plist-get (eglot--capabilities (eglot--current-process-or-lose)) feat))
+(defun eglot--server-capable (&rest feats)
+ "Determine if current server is capable of FEATS."
+ (cl-loop for caps = (eglot--capabilities (eglot--current-process-or-lose))
+ then (cadr probe)
+ for feat in feats
+ for probe = (plist-member caps feat)
+ if (not probe) do (cl-return nil)
+ if (eq (cadr probe) t) do (cl-return t)
+ if (eq (cadr probe) :json-false) do (cl-return nil)
+ finally (cl-return (or probe t))))
(defun eglot--range-region (range &optional markers)
"Return region (BEG END) that represents LSP RANGE.
@@ -1323,9 +1330,11 @@ DUMMY is ignored"
(lambda (obj)
(let ((documentation
(or (get-text-property 0 :documentation obj)
- (plist-get (eglot--request proc :completionItem/resolve
- (text-properties-at 0 obj))
- :documentation))))
+ (and (eglot--server-capable :completionProvider
+ :resolveProvider)
+ (plist-get (eglot--request proc
:completionItem/resolve
+ (text-properties-at 0 obj))
+ :documentation)))))
(when documentation
(with-current-buffer (get-buffer-create " *eglot doc*")
(erase-buffer)
- [elpa] externals/eglot c648c4f 08/15: Robustness fixes for the request mechanism, (continued)
- [elpa] externals/eglot c648c4f 08/15: Robustness fixes for the request mechanism, João Távora, 2018/05/20
- [elpa] externals/eglot 3f6d2e2 04/15: Close #4: Collect regions to change as markers, then edit, João Távora, 2018/05/20
- [elpa] externals/eglot a91d72c 01/15: Simplify some infrastructure fucntions, João Távora, 2018/05/20
- [elpa] externals/eglot 258fb98 12/15: Travis now runs python-language-server tests, João Távora, 2018/05/20
- [elpa] externals/eglot 99686a9 11/15: * eglot.el (Version): Bump to 0.4, João Távora, 2018/05/20
- [elpa] externals/eglot 6894ed7 13/15: Tweak tests, hopefully stabilize pyls tests on Travis, João Távora, 2018/05/20
- [elpa] externals/eglot 4b9f4da 03/15: If we're going to send rootPath, better send an absolute one, João Távora, 2018/05/20
- [elpa] externals/eglot 2ede684 06/15: Better decide what text exactly to present as completions, João Távora, 2018/05/20
- [elpa] externals/eglot 17b7740 05/15: * eglot.el (eglot-clear-status): Remember to update modeline, João Távora, 2018/05/20
- [elpa] externals/eglot b45cb80 02/15: Robustify timer handling for eglot--async-request, João Távora, 2018/05/20
- [elpa] externals/eglot ace6fce 07/15: Check capabilities before sending :completionItem/resolve,
João Távora <=
- [elpa] externals/eglot 24877ae 15/15: Fix a bug introduced in the previous commit, João Távora, 2018/05/20
- [elpa] externals/eglot 95c2052 09/15: Handle managed buffers in own process var, João Távora, 2018/05/20
- [elpa] externals/eglot 433361e 10/15: Add some completion tests for pyls, João Távora, 2018/05/20
- [elpa] externals/eglot 50b974f 14/15: Rewrite a couple of defs and shave a yak, João Távora, 2018/05/20