emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] 1.2 0f8091f 082/101: Fix a bug when response to definitions reque


From: Christian Johansson
Subject: [elpa] 1.2 0f8091f 082/101: Fix a bug when response to definitions request is a single location
Date: Thu, 29 Apr 2021 15:09:05 -0400 (EDT)

tag: 1.2
commit 0f8091f05a1337c42f6563833fcfe0c008897024
Author: Michał Krzywkowski <k.michal@zoho.com>
Commit: Michał Krzywkowski <k.michal@zoho.com>

    Fix a bug when response to definitions request is a single location
    
    It's valid to return just a single Location for a definitions request.
    
    * eglot.el (xref-backend-definitions): Coerce response to a vector.
---
 eglot.el | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/eglot.el b/eglot.el
index 2b683f8..f11a14e 100644
--- a/eglot.el
+++ b/eglot.el
@@ -1381,17 +1381,20 @@ DUMMY is ignored."
 (cl-defmethod xref-backend-definitions ((_backend (eql eglot)) identifier)
   (let* ((rich-identifier
           (car (member identifier eglot--xref-known-symbols)))
-         (location-or-locations
+         (definitions
           (if rich-identifier
               (get-text-property 0 :locations rich-identifier)
             (jsonrpc-request (eglot--current-server-or-lose)
                              :textDocument/definition
                              (get-text-property
-                              0 :textDocumentPositionParams identifier)))))
+                              0 :textDocumentPositionParams identifier))))
+         (locations
+          (and definitions
+               (if (vectorp definitions) definitions (vector definitions)))))
     (eglot--sort-xrefs
      (mapcar (jsonrpc-lambda (&key uri range)
                (eglot--xref-make identifier uri (plist-get range :start)))
-             location-or-locations))))
+             locations))))
 
 (cl-defmethod xref-backend-references ((_backend (eql eglot)) identifier)
   (unless (eglot--server-capable :referencesProvider)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]