[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 1.2 3432d21 037/101: Per #74: Fix eglot-capabilities when queryin
From: |
Christian Johansson |
Subject: |
[elpa] 1.2 3432d21 037/101: Per #74: Fix eglot-capabilities when querying for multiple features |
Date: |
Thu, 29 Apr 2021 15:08:56 -0400 (EDT) |
tag: 1.2
commit 3432d213c2d1bcdb5f21c38533d228e2a65baf58
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>
Per #74: Fix eglot-capabilities when querying for multiple features
* eglot-tests.el (eglot-capabilities): New test.
* eglot.el (eglot--server-capable): Fix problems with queries for
multiple capabilities.
---
eglot-tests.el | 22 ++++++++++++++++++++++
eglot.el | 6 +++---
2 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/eglot-tests.el b/eglot-tests.el
index 0598d9e..47a3b34 100644
--- a/eglot-tests.el
+++ b/eglot-tests.el
@@ -504,6 +504,28 @@ Pass TIMEOUT to `eglot--with-timeout'."
`((python-mode . ("sh" "-c" "sleep 2 && pyls")))))
(should-error (apply #'eglot--connect (eglot--guess-contact)))))))
+(ert-deftest eglot-capabilities ()
+ "Unit test for `eglot--server-capable'."
+ (cl-letf (((symbol-function 'eglot--capabilities)
+ (lambda (_dummy)
+ ;; test data lifted from Golangserver example at
+ ;; https://github.com/joaotavora/eglot/pull/74
+ (list :textDocumentSync 2 :hoverProvider t
+ :completionProvider '(:triggerCharacters ["."])
+ :signatureHelpProvider '(:triggerCharacters ["(" ","])
+ :definitionProvider t :typeDefinitionProvider t
+ :referencesProvider t :documentSymbolProvider t
+ :workspaceSymbolProvider t :implementationProvider t
+ :documentFormattingProvider t
:xworkspaceReferencesProvider t
+ :xdefinitionProvider t :xworkspaceSymbolByProperties t)))
+ ((symbol-function 'eglot--current-server-or-lose)
+ (lambda () nil)))
+ (should (eql 2 (eglot--server-capable :textDocumentSync)))
+ (should (eglot--server-capable :completionProvider :triggerCharacters))
+ (should (equal '(:triggerCharacters ["."]) (eglot--server-capable
:completionProvider)))
+ (should-not (eglot--server-capable :foobarbaz))
+ (should-not (eglot--server-capable :textDocumentSync :foobarbaz))))
+
(provide 'eglot-tests)
;;; eglot-tests.el ends here
diff --git a/eglot.el b/eglot.el
index 88c6b45..63fbce2 100644
--- a/eglot.el
+++ b/eglot.el
@@ -728,12 +728,12 @@ under cursor."
feats)
(cl-loop for caps = (eglot--capabilities (eglot--current-server-or-lose))
then (cadr probe)
- for feat in feats
+ for (feat . more) on feats
for probe = (plist-member caps feat)
if (not probe) do (cl-return nil)
if (eq (cadr probe) :json-false) do (cl-return nil)
- if (not (listp (cadr probe))) do (cl-return (cadr probe))
- finally (cl-return (or probe t)))))
+ if (not (listp (cadr probe))) do (cl-return (if more nil (cadr
probe)))
+ finally (cl-return (or (cadr probe) t)))))
(defun eglot--range-region (range &optional markers)
"Return region (BEG . END) that represents LSP RANGE.
- [elpa] 1.2 01ec85f 011/101: Implement TextDocument/rangeFormatting, (continued)
- [elpa] 1.2 01ec85f 011/101: Implement TextDocument/rangeFormatting, Christian Johansson, 2021/04/29
- [elpa] 1.2 d1cfc9e 008/101: Work around Emacs bugs 32237, 32278 (#53), Christian Johansson, 2021/04/29
- [elpa] 1.2 e33fadb 012/101: * eglot.el (eglot-client-capabilities): Fix a typo., Christian Johansson, 2021/04/29
- [elpa] 1.2 ee372b4 022/101: * eglot.el (advice-add jsonrpc-request): Add &allow-other-keys, Christian Johansson, 2021/04/29
- [elpa] 1.2 9bf88ee 031/101: Allow tests to be run with custom jsonrpc.el, Christian Johansson, 2021/04/29
- [elpa] 1.2 cf3376a 034/101: Close #64: handle edits to same position in the correct order, Christian Johansson, 2021/04/29
- [elpa] 1.2 5e30066 032/101: Update README.md, Christian Johansson, 2021/04/29
- [elpa] 1.2 afa5439 027/101: Kill server's output and events buffers from eglot-shutdown (#66), Christian Johansson, 2021/04/29
- [elpa] 1.2 d6b49d8 028/101: * README.md (Build Status): Show status for master, Christian Johansson, 2021/04/29
- [elpa] 1.2 c2e05a3 030/101: Close #68: Implement asynchronous server connection, Christian Johansson, 2021/04/29
- [elpa] 1.2 3432d21 037/101: Per #74: Fix eglot-capabilities when querying for multiple features,
Christian Johansson <=
- [elpa] 1.2 6eac51f 061/101: Sort references and definitions by line number, Christian Johansson, 2021/04/29
- [elpa] 1.2 88a4f8c 044/101: Actually add snippet example gif referenced in README.md, Christian Johansson, 2021/04/29
- [elpa] 1.2 29d641b 066/101: Handle case when project was not found in eclipse.jdt.ls contact, Christian Johansson, 2021/04/29
- [elpa] 1.2 2971683 075/101: Rework test macros for hopefully more stable testing, Christian Johansson, 2021/04/29
- [elpa] 1.2 3b3c1db 036/101: Close #73: Prompt for server in interactive eglot-shutdown, Christian Johansson, 2021/04/29
- [elpa] 1.2 a1cc0ad 043/101: * README.md (Obligatory animated gif section): Add snippet gif., Christian Johansson, 2021/04/29
- [elpa] 1.2 3532bd0 064/101: Per #63: Add support for eclipse.jdt.ls server, Christian Johansson, 2021/04/29
- [elpa] 1.2 0ef245f 051/101: Fix serious breakage introduced by #93, Christian Johansson, 2021/04/29
- [elpa] 1.2 71012bc 067/101: Add tests for eclipse.jdt.ls connection, Christian Johansson, 2021/04/29
- [elpa] 1.2 ea2fcc7 087/101: * eglot-tests.el (eclipse-connect): Increase connect timeout to 20., Christian Johansson, 2021/04/29