Skip to content

Commit

Permalink
Merge pull request #1092 from fuyu0425/find-fallback
Browse files Browse the repository at this point in the history
use find-def/ref fallback when there is no lsp server
  • Loading branch information
manateelazycat authored Oct 24, 2024
2 parents 5e56390 + 4c1be88 commit ae72b62
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lsp-bridge.el
Original file line number Diff line number Diff line change
Expand Up @@ -1959,7 +1959,9 @@ Off by default."
(lsp-bridge--set-mark-ring-in-new-buffer))
(t
(setq-local lsp-bridge-jump-to-def-in-other-window nil)
(lsp-bridge-call-file-api "find_define" (lsp-bridge--position)))))
(if (lsp-bridge-has-lsp-server-p)
(lsp-bridge-call-file-api "find_define" (lsp-bridge--position))
(lsp-bridge-find-def-fallback (lsp-bridge--position))))))

(defun lsp-bridge-find-def-other-window ()
(interactive)
Expand All @@ -1970,7 +1972,9 @@ Off by default."
(lsp-bridge--set-mark-ring-in-new-buffer))
(t
(setq-local lsp-bridge-jump-to-def-in-other-window t)
(lsp-bridge-call-file-api "find_define" (lsp-bridge--position)))))
(if (lsp-bridge-has-lsp-server-p)
(lsp-bridge-call-file-api "find_define" (lsp-bridge--position))
(lsp-bridge-find-def-fallback (lsp-bridge--position))))))

(defun lsp-bridge-find-def-return ()
"Pop off lsp-bridge-mark-ring and jump to the top location."
Expand Down Expand Up @@ -2019,7 +2023,9 @@ Off by default."

(defun lsp-bridge-find-references ()
(interactive)
(lsp-bridge-call-file-api "find_references" (lsp-bridge--position)))
(if (lsp-bridge-has-lsp-server-p)
(lsp-bridge-call-file-api "find_references" (lsp-bridge--position))
(lsp-bridge-find-ref-fallback (lsp-bridge--position))))

(defun lsp-bridge-find-def-fallback (position)
(if (not (= (length lsp-bridge-peek-ace-list) 0))
Expand Down

0 comments on commit ae72b62

Please sign in to comment.