]> git.eshelyaron.com Git - emacs.git/commitdiff
Eglot: fix call hierarchy navigation again (bug#78367, bug#78250)
authorJoão Távora <joaotavora@gmail.com>
Sun, 11 May 2025 10:09:06 +0000 (11:09 +0100)
committerEshel Yaron <me@eshelyaron.com>
Mon, 12 May 2025 19:55:24 +0000 (21:55 +0200)
* lisp/progmodes/eglot.el (eglot--hierarchy-label): Fix again.

(cherry picked from commit c69c18b732c2b1cd772dc7e15c0ea3074a3492bc)

lisp/progmodes/eglot.el

index ae7d63dc9d927253978ec8c41d00d34554e216dd..9a1f5cce4e683472beb8bcac413b88bb9da68c63 100644 (file)
@@ -4666,13 +4666,22 @@ If NOERROR, return predicate, else erroring function."
        'keymap eglot-hierarchy-label-map
        'action
        (lambda (_btn)
-         (pop-to-buffer (find-file-noselect (eglot-uri-to-path (or parent-uri uri))))
-         (eglot--goto
-          (or
-           (elt
-            (get-text-property 0 'eglot--hierarchy-call-sites name)
-            0)
-           item-range))))
+         (let* ((method
+                 (get-text-property 0 'eglot--hierarchy-method name))
+                (target-uri
+                 (if (eq method :callHierarchy/outgoingCalls)
+                     ;; We probably want `parent-uri' for this edge case
+                     ;; because that's where the call site we want
+                     ;; lives.  (bug#78250, bug#78367).
+                     (or parent-uri uri)
+                   uri)))
+           (pop-to-buffer (find-file-noselect (eglot-uri-to-path target-uri)))
+           (eglot--goto
+            (or
+             (elt
+              (get-text-property 0 'eglot--hierarchy-call-sites name)
+              0)
+             item-range)))))
       (buffer-string))))
 
 (defun eglot--hierarchy-1 (name provider preparer specs)