[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eglot be15bb1 43/62: Per #74: Fix eglot-capabilities wh
From: |
Stefan Monnier |
Subject: |
[elpa] externals/eglot be15bb1 43/62: Per #74: Fix eglot-capabilities when querying for multiple features |
Date: |
Sat, 29 Sep 2018 17:13:35 -0400 (EDT) |
branch: externals/eglot
commit be15bb14fd09216c1b2fb9f56d5dfcbc907f2c6b
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
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] externals/eglot 2728e12 22/62: Per #59: eglot-workspace-configuration's keys needn't be keywords, (continued)
- [elpa] externals/eglot 2728e12 22/62: Per #59: eglot-workspace-configuration's keys needn't be keywords, Stefan Monnier, 2018/09/29
- [elpa] externals/eglot fd7e587 27/62: Require jsonrpc.el 1.0.2 (GNU ELPA didn't build 1.0.1), Stefan Monnier, 2018/09/29
- [elpa] externals/eglot 99fd6a4 30/62: * eglot.el (eglot-cquery): Capitalize docstring., Stefan Monnier, 2018/09/29
- [elpa] externals/eglot fdd021c 26/62: Close #61: Snappier completions that don't hinder typing, Stefan Monnier, 2018/09/29
- [elpa] externals/eglot 22b0c89 41/62: Add kotlin-language-server (#70), Stefan Monnier, 2018/09/29
- [elpa] externals/eglot 3ffea45 44/62: Close #50: Support snippet completions, Stefan Monnier, 2018/09/29
- [elpa] externals/eglot e711bdb 47/62: Add go-langserver (#74), Stefan Monnier, 2018/09/29
- [elpa] externals/eglot 83d7025 36/62: Close #68: Implement asynchronous server connection, Stefan Monnier, 2018/09/29
- [elpa] externals/eglot 2355e17 23/62: Per #63: Accept functions as entries in eglot-server-programs, Stefan Monnier, 2018/09/29
- [elpa] externals/eglot c0f9db7 46/62: Per #74: Don't error if server replies with empty hover message, Stefan Monnier, 2018/09/29
- [elpa] externals/eglot be15bb1 43/62: Per #74: Fix eglot-capabilities when querying for multiple features,
Stefan Monnier <=
- [elpa] externals/eglot 15040a6 48/62: Improve snippet support, Stefan Monnier, 2018/09/29
- [elpa] externals/eglot d88f6aa 54/62: Close #86: Handle case when :textDocumentSync isn't a number, Stefan Monnier, 2018/09/29
- [elpa] externals/eglot 42fffa5 16/62: Close #54: Correctly make LSP positions in narrowed buffers, Stefan Monnier, 2018/09/29
- [elpa] externals/eglot e935718 20/62: Fix placement of diagnostics with same start and end positions, Stefan Monnier, 2018/09/29
- [elpa] externals/eglot 88ebed6 17/62: Implement TextDocument/rangeFormatting, Stefan Monnier, 2018/09/29
- [elpa] externals/eglot 792dc6b 28/62: * eglot.el (advice-add jsonrpc-request): Add &allow-other-keys, Stefan Monnier, 2018/09/29
- [elpa] externals/eglot 21886be 08/62: Close #44: Robustify in the face of manual mode changes, Stefan Monnier, 2018/09/29
- [elpa] externals/eglot 6b14711 18/62: * eglot.el (eglot-client-capabilities): Fix a typo., Stefan Monnier, 2018/09/29
- [elpa] externals/eglot 4c019bd 24/62: * eglot.el (eglot-initialization-options): Fix spurious typo., Stefan Monnier, 2018/09/29
- [elpa] externals/eglot a62c2da 25/62: Close #60: Notify server of recent changes before save notification, Stefan Monnier, 2018/09/29