Closed getong closed 1 month ago
没有。我设置了false,也不行。
卡顿很厉害,会卡住我的lsp-bridge buffer,不给日志输出。
emacs -Q 试过吗?
试过了,我手动启用了lsp-bridge,但lsp-bridge-find-def 就不起效了。 你可以试试我的仓库,https://github.com/getong/rust_example/tree/main/rusty_v8_example 就是这个仓库,查找v8模块调用卡顿很明显。
你要怎么设置? cargo 先 build ?
最好给我完整的重现步骤
(use-package
lsp-bridge
:straight '(lsp-bridge :type git :host github :repo "manateelazycat/lsp-bridge" :files (:defaults "*.el" "*.py" "acm" "core" "langserver" "multiserver" "resources") :build (:not compile))
:defer t
:commands (lsp-bridge-mode)
;; (add-hook 'lsp-bridge-mode-hook #'lsp-bridge-mode-hook-func)
:hook
((dart-mode
;; emacs-lisp-mode
lua-mode c++-mode swift-mode c-mode)
. lsp-bridge-mode)
((java-mode kotlin-mode) . setup-lsp-bridge-kotlin-mode)
((csharp-mode python-mode) . setup-lsp-bridge-python-mode)
((rust-mode rustic-mode) . setup-lsp-bridge-rust-mode)
(go-mode . setup-lsp-bridge-golang-mode)
((typescript-mode js-mode vue-mode solidity-mode) . setup-lsp-bridge-vue-mode)
:bind
(:map
lsp-bridge-mode-map
("M-." . lsp-bridge-find-def)
("M-n ." . lsp-bridge-find-def-other-window)
("M-n i" . lsp-bridge-find-impl)
("M-n I" . lsp-bridge-find-impl-other-window)
("M-," . lsp-bridge-find-def-return)
("M-?" . lsp-bridge-find-references)
("M-n r" . lsp-bridge-rename)
("M-n l" . lsp-bridge-diagnostic-list)
("M-n n" . lsp-bridge-diagnostic-jump-next)
("M-n p" . lsp-bridge-diagnostic-jump-prev)
("M-n h" . lsp-bridge-popup-documentation)
("M-n u" . lsp-bridge-popup-documentation-scroll-up)
("M-n d" . lsp-bridge-popup-documentation-scroll-down)
;; ("C-c M-f" . lsp-bridge-code-format) ;; replace by blacken
)
:custom
(cond
((eq system-type 'darwin) ; macOS
(setq lsp-bridge-python-command "/usr/local/bin/python3")
(setq lsp-pyright-python-executable-cmd "/usr/local/bin/python3"))
((eq system-type 'gnu/linux) ; Linux
(setq lsp-bridge-python-command "/usr/bin/python3")
(setq lsp-pyright-python-executable-cmd "/usr/bin/python3")))
(acm-backend-lsp-enable-auto-import t)
(lsp-bridge-enable-with-tramp t)
(lsp-bridge-remote-start-automatically t)
(lsp-bridge-enable-org-babel t)
(tabnine-bridge-binaries-folder (expand-file-name "~/.backup-emacs/tabnine-bridge/tabnine-binaries"))
(lsp-bridge-enable-log t)
(lsp-bridge-symbols-enable-which-func t)
(acm-enable-icon t)
(acm-enable-doc t)
(acm-enable-tabnine t)
(acm-enable-quick-access t)
(lsp-bridge-enable-inlay-hint t)
(lsp-bridge-find-def-select-in-open-windows t)
;; (lsp-bridge-signature-show-function 'lsp-bridge-signature-show-with-frame)
;; (lsp-bridge-signature-show-with-frame-position 'top-right)
(lsp-bridge-enable-completion-in-minibuffer t)
(acm-backend-yas-match-by-trigger-keyword t)
;; (lsp-bridge-signature-show-function 'lsp-bridge-signature-posframe)
(lsp-bridge-c-lsp-server "ccls")
(acm-enable-codeium t)
(lsp-bridge-enable-signature-help t)
;; (lsp-bridge-complete-manually t)
(codeium-bridge-folder (expand-file-name "~/.backup-emacs/codeium"))
(acm-backend-codeium-api-key-path (expand-file-name "~/.backup-emacs/codeium/codeium_api_key.txt"))
(lsp-bridge-popup-documentation-buffer "*lsp-bridge-hover*")
(lsp-bridge-signature-buffer "*lsp-bridge-signature*")
(lsp-bridge-diagnostic-buffer "*lsp-bridge-diagnostic*")
(lsp-bridge-csharp-lsp-server "csharp-ls")
(acm-candidate-match-function #'orderless-flex)
:config (advice-add #'save-buffer :after #'acm-hide)
;; (global-lsp-bridge-mode)
(unless (file-exists-p (expand-file-name "~/.backup-emacs/tabnine-bridge/tabnine-binaries"))
(funcall-interactively #'lsp-bridge-install-tabnine))
(unless (file-exists-p (expand-file-name "~/.backup-emacs/codeium"))
(funcall-interactively #'lsp-bridge-install-update-codeium))
;; detect rust project
(defun find-rust-prj-root (dir)
"Find the Rust project root of DIR."
(file-truename (locate-dominating-file dir "Cargo.toml")))
(defun setup-lsp-bridge-rust-mode ()
(setq lsp-bridge-get-project-path-by-filepath #'find-rust-prj-root)
(lsp-bridge-mode))
;; detect gradle project
(defun find-gradle-prj-root (dir)
"Find the gradle project root of DIR."
(file-truename (locate-dominating-file dir "gradlew")))
(defun setup-lsp-bridge-kotlin-mode ()
(setq lsp-bridge-get-project-path-by-filepath #'find-gradle-prj-root)
(lsp-bridge-mode))
;; detect python project
(defun find-python-prj-root (dir)
"Find the python project root of DIR."
(file-truename (locate-dominating-file dir ".git")))
(defun setup-lsp-bridge-python-mode ()
(setq lsp-bridge-get-project-path-by-filepath #'find-python-prj-root)
(lsp-bridge-mode))
;; detect go project
(defun find-golang-prj-root (dir)
"Find the golang project root of DIR."
(file-truename (locate-dominating-file dir "go.mod")))
(defun setup-lsp-bridge-golang-mode ()
(setq lsp-bridge-get-project-path-by-filepath #'find-golang-prj-root)
(lsp-bridge-mode))
;; detect vue project
(defun find-vue-prj-root (dir)
"Find the vue project root of DIR."
(file-truename (locate-dominating-file dir "package.json")))
(defun setup-lsp-bridge-vue-mode ()
(setq lsp-bridge-get-project-path-by-filepath #'find-vue-prj-root)
(lsp-bridge-mode)))
拷贝这个目录到本地目录, 直接打开 src/main.rs, 然后试着对着几个v8::*函数进行lsp-bridge-find-find, 每个都会卡住。我就是这样操作的。
我的意思是, Rust这个项目需要怎么构建一下? 我的每次都是 [LSP-Bridge] No definition found.
cargo build
把这个目录里面两个文件拷贝到一个单独目录就可以了,cargo build, 这是个独立的rust项目
我看到你有几个 detect 函数, 我写了一个补丁 https://github.com/manateelazycat/lsp-bridge/commit/34f92a50eb77452147c8b8ba23707c809a617e32
你的那几个 detect 函数都可以删除啦。
我看了是因为, rust_example 是一个 git 目录, 但是 rust_example 下没有 Cargo.toml, 所以 rust lsp server 一直都在 workspace progress 中, 如果你把 rusty_v8_example 单独拷贝出来 cargo build 是可以定义跳转的
rust project
看日志,应该找到了对应的文件,但没有进行跳转。