manateelazycat / lsp-bridge

A blazingly fast LSP client for Emacs
GNU General Public License v3.0
1.42k stars 205 forks source link

elisp 开启lsp-bridge,跳转返回时,提示:[LSP-Bridge] No lsp-bridge mark set #925

Closed chap9 closed 5 months ago

chap9 commented 5 months ago

最小复现配置:

;;; -*- lexical-binding: t -*-

(setq package-enable-at-startup nil)

(setq current-language-environment "UTF-8")

(defvar bootstrap-version)
(let
  (
    (bootstrap-file
      (expand-file-name "straight/repos/straight.el/bootstrap.el"
        user-emacs-directory))
    (bootstrap-version 6))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
      (url-retrieve-synchronously
        "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
        'silent
        'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

(straight-use-package 'yasnippet)
(require 'yasnippet)
(yas-reload-all)

(setq treesit-extra-load-path
  (list (expand-file-name "tree-sitter" user-emacs-directory)))

(setq treesit-language-source-alist
  '
  ((bash . ("https://github.com/tree-sitter/tree-sitter-bash"))
    (c . ("https://github.com/tree-sitter/tree-sitter-c"))
    (cpp . ("https://github.com/tree-sitter/tree-sitter-cpp"))
    (css . ("https://github.com/tree-sitter/tree-sitter-css"))
    (cmake . ("https://github.com/uyha/tree-sitter-cmake"))
    (csharp
      .
      ("https://github.com/tree-sitter/tree-sitter-c-sharp.git"))
    (dockerfile
      .
      ("https://github.com/camdencheek/tree-sitter-dockerfile"))
    (elisp . ("https://github.com/Wilfred/tree-sitter-elisp"))
    (go . ("https://github.com/tree-sitter/tree-sitter-go"))
    (gomod
      .
      ("https://github.com/camdencheek/tree-sitter-go-mod.git"))
    (html . ("https://github.com/tree-sitter/tree-sitter-html"))
    (java . ("https://github.com/tree-sitter/tree-sitter-java.git"))
    (javascript
      .
      ("https://github.com/tree-sitter/tree-sitter-javascript"))
    (json . ("https://github.com/tree-sitter/tree-sitter-json"))
    (lua . ("https://github.com/Azganoth/tree-sitter-lua"))
    (make . ("https://github.com/alemuller/tree-sitter-make"))
    (markdown
      .
      ("https://github.com/MDeiml/tree-sitter-markdown"
        nil
        "tree-sitter-markdown/src"))
    (ocaml
      .
      ("https://github.com/tree-sitter/tree-sitter-ocaml"
        nil
        "ocaml/src"))
    (org . ("https://github.com/milisims/tree-sitter-org"))
    (python . ("https://github.com/tree-sitter/tree-sitter-python"))
    (php . ("https://github.com/tree-sitter/tree-sitter-php"))
    (typescript
      .
      ("https://github.com/tree-sitter/tree-sitter-typescript"
        nil
        "typescript/src"))
    (tsx
      .
      ("https://github.com/tree-sitter/tree-sitter-typescript"
        nil
        "tsx/src"))
    (ruby . ("https://github.com/tree-sitter/tree-sitter-ruby"))
    (rust . ("https://github.com/tree-sitter/tree-sitter-rust"))
    (sql . ("https://github.com/m-novikov/tree-sitter-sql"))
    (vue . ("https://github.com/merico-dev/tree-sitter-vue"))
    (yaml . ("https://github.com/ikatyang/tree-sitter-yaml"))
    (toml . ("https://github.com/tree-sitter/tree-sitter-toml"))
    (zig . ("https://github.com/GrayJack/tree-sitter-zig"))))

(straight-use-package
  '
  (lsp-bridge
    :type git
    :host github
    :repo "manateelazycat/lsp-bridge"
    :files
    (:defaults
      "*.el"
      "*.py"
      "acm"
      "core"
      "langserver"
      "multiserver"
      "resources")
    :build (:not compile)))

(require 'lsp-bridge)

;; 取消全局绑定
(unbind-key (kbd "M-.") 'global-map)
(unbind-key (kbd "M-,") 'global-map)
(define-key lsp-bridge-mode-map (kbd "M-.") 'lsp-bridge-find-def)
(define-key
  lsp-bridge-mode-map
  (kbd "M-,")
  'lsp-bridge-find-def-return)

(require 'elisp-mode)
(add-to-list 'auto-mode-alist '("\\.el\\'" . emacs-lisp-mode))
(add-hook 'emacs-lisp-mode-hook 'lsp-bridge-mode)

在elisp代码中,开启lsp-bridge,调用 lsp-bridge-find-def 可以正常跳转,但跳转后如果想调用 lsp-bridge-find-def-return 返回时,会收到提示: “[LSP-Bridge] No lsp-bridge mark set”并且不会跳回原位置。

manateelazycat commented 5 months ago

lsp-bridge-find-def-return

目前只支持lsp语言,elisp后端还不支持

manateelazycat commented 5 months ago

@MatthewZMD 能帮我看一下这个issue吗? 我尝试在 elisp 定义跳转之前记录 lsp-bridge-mark-ring , 但是总是不成功, 谢谢。

manateelazycat commented 5 months ago

最新版已经修复。