[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eglot 14ab804 54/69: Fix #318: unbreak xref-find-defini
From: |
João Távora |
Subject: |
[elpa] externals/eglot 14ab804 54/69: Fix #318: unbreak xref-find-definitions |
Date: |
Sun, 20 Oct 2019 08:21:52 -0400 (EDT) |
branch: externals/eglot
commit 14ab804d67d3cc671bba2212f893b4baddabe02c
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
Fix #318: unbreak xref-find-definitions
* eglot-tests.el (basic-xref): New test.
* eglot.el (eglot--collecting-xrefs): Add an edebug spec.
(eglot--lsp-xrefs-for-method): Actually collect xref.
(xref-backend-apropos): Fix indentation slightly.
---
eglot-tests.el | 12 ++++++++++++
eglot.el | 29 +++++++++++++++--------------
2 files changed, 27 insertions(+), 14 deletions(-)
diff --git a/eglot-tests.el b/eglot-tests.el
index 6a544d9..c01c699 100644
--- a/eglot-tests.el
+++ b/eglot-tests.el
@@ -449,6 +449,18 @@ Pass TIMEOUT to `eglot--with-timeout'."
(completion-at-point)
(should (looking-back "sys.exit")))))
+(ert-deftest basic-xref ()
+ "Test basic xref functionality in a python LSP"
+ (skip-unless (executable-find "pyls"))
+ (eglot--with-fixture
+ '(("project" . (("something.py" . "def foo(): pass\ndef bar(): foo()"))))
+ (with-current-buffer
+ (eglot--find-file-noselect "project/something.py")
+ (should (eglot--tests-connect))
+ (search-forward "bar(): f")
+ (call-interactively 'xref-find-definitions)
+ (should (looking-at "foo(): pass")))))
+
(ert-deftest hover-after-completions ()
"Test documentation echo in a python LSP"
(skip-unless (executable-find "pyls"))
diff --git a/eglot.el b/eglot.el
index 9d5c546..7b0e3e2 100644
--- a/eglot.el
+++ b/eglot.el
@@ -1724,6 +1724,7 @@ Calls REPORT-FN maybe if server publishes diagnostics in
time."
(cl-defmacro eglot--collecting-xrefs ((collector) &rest body)
"Sort and handle xrefs collected with COLLECTOR in BODY."
+ (declare (indent 1) (debug (sexp &rest form)))
(let ((collected (cl-gensym "collected")))
`(unwind-protect
(let (,collected)
@@ -1786,13 +1787,13 @@ Try to visit the target file for a richer summary line."
"/"))))))
(eglot--error "Sorry, this server doesn't do %s" method))
(eglot--collecting-xrefs (collect)
- (mapc
- (eglot--lambda ((Location) uri range)
- (eglot--xref-make (symbol-at-point) uri range))
- (jsonrpc-request
- (eglot--current-server-or-lose) method (append
-
(eglot--TextDocumentPositionParams)
- extra-params)))))
+ (mapc
+ (eglot--lambda ((Location) uri range)
+ (collect (eglot--xref-make (symbol-at-point) uri range)))
+ (jsonrpc-request
+ (eglot--current-server-or-lose) method (append
+
(eglot--TextDocumentPositionParams)
+ extra-params)))))
(cl-defun eglot--lsp-xref-helper (method &key extra-params capability )
"Helper for `eglot-find-declaration' & friends."
@@ -1829,13 +1830,13 @@ Try to visit the target file for a richer summary line."
(cl-defmethod xref-backend-apropos ((_backend (eql eglot)) pattern)
(when (eglot--server-capable :workspaceSymbolProvider)
(eglot--collecting-xrefs (collect)
- (mapc
- (eglot--lambda ((SymbolInformation) name location)
- (eglot--dbind ((Location) uri range) location
- (collect (eglot--xref-make name uri range))))
- (jsonrpc-request (eglot--current-server-or-lose)
- :workspace/symbol
- `(:query ,pattern))))))
+ (mapc
+ (eglot--lambda ((SymbolInformation) name location)
+ (eglot--dbind ((Location) uri range) location
+ (collect (eglot--xref-make name uri range))))
+ (jsonrpc-request (eglot--current-server-or-lose)
+ :workspace/symbol
+ `(:query ,pattern))))))
(defun eglot-format-buffer ()
"Format contents of current buffer."
- [elpa] externals/eglot e28b396 25/69: Fix #259: work around a bug in Emacs's change detection, (continued)
- [elpa] externals/eglot e28b396 25/69: Fix #259: work around a bug in Emacs's change detection, João Távora, 2019/10/20
- [elpa] externals/eglot 2372bc8 30/69: Fixed extra ) in python example snippet (#287), João Távora, 2019/10/20
- [elpa] externals/eglot 6d87de1 35/69: Treat null/nil server capabilities as false, João Távora, 2019/10/20
- [elpa] externals/eglot 7f31f29 36/69: Use gopls server as the default for Go (#304), João Távora, 2019/10/20
- [elpa] externals/eglot 4548202 28/69: Simplify eldoc usage (#269), João Távora, 2019/10/20
- [elpa] externals/eglot 36b7cf32 38/69: Fix #272: also use signature label offsets for parameter info, João Távora, 2019/10/20
- [elpa] externals/eglot 059ea59 43/69: Optionally shutdown after killing last buffer of managed project (#309), João Távora, 2019/10/20
- [elpa] externals/eglot 59ba0b1 39/69: New README section on how to best report bugs to Eglot, João Távora, 2019/10/20
- [elpa] externals/eglot ce983d1 47/69: Revert "Treat null/nil server capabilities as false", João Távora, 2019/10/20
- [elpa] externals/eglot 4693abf 50/69: Fix #258: Allow user to set idle time to wait before processing changes, João Távora, 2019/10/20
- [elpa] externals/eglot 14ab804 54/69: Fix #318: unbreak xref-find-definitions,
João Távora <=
- [elpa] externals/eglot dbb5dd4 57/69: Slightly more robust completion tests, João Távora, 2019/10/20
- [elpa] externals/eglot 3604173 64/69: Unbreak eglot--setq-saving if symbol is unbound, João Távora, 2019/10/20
- [elpa] externals/eglot a11a41b 63/69: Use of company-capf backend in eglot-managed buffers, João Távora, 2019/10/20
- [elpa] externals/eglot 6e93622 27/69: Fix #273: leniently handle invalid positions sent by some servers, João Távora, 2019/10/20
- [elpa] externals/eglot 254fee0 46/69: Use more pyls and less rls in tests, João Távora, 2019/10/20
- [elpa] externals/eglot 0e5e08d 51/69: Support goto-{declaration, implementation, typeDefinition}, João Távora, 2019/10/20
- [elpa] externals/eglot 5a21670 59/69: Fix bug in workspace/didChangeWatchedfiles, João Távora, 2019/10/20
- [elpa] externals/eglot 9359c15 58/69: Close #316: add support for the Ada Language Server, João Távora, 2019/10/20
- [elpa] externals/eglot d6508e0 29/69: Fix #273: fix a typo, João Távora, 2019/10/20
- [elpa] externals/eglot 28ecd5d 34/69: Change the default of eglot-move-to-column-function, João Távora, 2019/10/20