lsp-bridge -- 速度最快的语法补全插件

试了下,不起作用,我的操作流程是,

  1. 打开 lib.rs
  2. Cargo.toml 中添加依赖
  3. 打开 compile 命令
  4. 输入 cargo fetch
  5. 重新进入 lib.rs 发现补全不起作用
    要不要添加一个命令,手动加载 Cargo.toml 更新内容 ?

你加了包后直接restart lsp-bridge就好了,添加包次数也不会太多。

按照github上的配置没有出现补全的弹出框?是需要在Mac下安装 Qt来绘制补全窗口

出现的错误: File “/Users/apple/.emacs.d/elpa/lsp-bridge/lsp_bridge.py”, line 30, in from epc.server import ThreadingEPCServer ModuleNotFoundError: No module named ‘epc’

系统是mac,org:28.2.

readme里搜 python-epc

已经安装了pip install epc。下面的代码如何运行?

(require 'epc)

(defvar my-epc (epc:start-epc "python" '("my-server.py")))

(deferred:$
  (epc:call-deferred my-epc 'echo '(10))
  (deferred:nextc it
    (lambda (x) (message "Return : %S" x))))

(message "Return : %S" (epc:call-sync my-epc 'echo '(10 40)))

Python-EPC 本身需要安装么?

在org-mode中的python 下可以用lsp-bridge 补全么?

#+BEGIN_SRC python :results output

#+END_SRC

可以。zsbd

需要如何另外设置?目前在.py文件中可以补全。在org-mode 中的python下没有补全。

在这个代码块中的编辑: #+BEGIN_SRC python :results output

#+END_SRC

你也可以通过C-c ', 在另外一个 window 中编辑 (切换 Python 为主模式), lsp-bridge 就工作得挺好的啊 ~

1 个赞

目前就是 @EthanLin 说的这样,你说的那种情况还没有实现哦。

lsp-bridge 已经实现了用posframe 去现实函数签名了吧,我今天看代码突然发现的。。。。。

很早就有啊, lsp-bridge-signature-show-function, 中文README有。

我今天配置了 lsp-bridge 以后发现用 daemon 启动会卡住,但是非 daemon 启动是正常的,经过排查发现是一个修改主题的函数导致的。

  (dolist (theme custom-enabled-themes)
    (unless (custom-theme-p theme)
      (load-theme theme)))

将这行代码注释以后可以正常启动。这是哪里冲突了吗?

什么函数?在哪里?什么时候调用?被谁调用?

;;Ensure that themes will be applied even if they have not been customized
(defun reapply-themes ()
  "Forcibly load the themes listed in `custom-enabled-themes'."
  (dolist (theme custom-enabled-themes)
    (unless (custom-theme-p theme)
      (load-theme theme)))
  (custom-set-variables `(custom-enabled-themes (quote ,custom-enabled-themes))))

(add-hook 'after-init-hook 'reapply-themes)

这是完整的主题设置函数,调用时机是在启动的时候。这个主题设置写在 lsp-bridge 的设置以前,但是我把这个设置放在 lsp-bridge 设置以后也会卡住。

卡住问题, 只能自己写代码, 往外部文件写日志, 直到你找到哪一行代码卡住了。

每个Emacser的配置都很复杂, 我没有时间也没有能力猜到为什么会卡住。

或许是我没有表达清楚,我已经定位到了问题。在 after-init-hook 中加入 load-theme 后,lsp-bridge 会卡住 --daemon.

(setq custom-safe-themes t)
(setq-default custom-enabled-themes '(deeper-blue))

(defun reapply-themes()
  (load-theme 'deeper-blue))

(add-hook 'after-init-hook 'reapply-themes)

(add-to-list 'load-path "/Users/takaobsid/.emacs.d/lsp-bridge/")

(require 'yasnippet)
(yas-global-mode 1)

(require 'lsp-bridge)
(global-lsp-bridge-mode)

这是复现问题需要的最短配置,在纯净 emacs 的基础上只安装了 lsp-bridge,yasnippet 和 markdown-mode。然后使用 emacs --daemon,就会卡住。

我的意思是你自己打印排查一下哪里冲突了, 我没有时间去排查每个人的配置。

如果确实排查是 lsp-bridge 的问题, 欢迎发送PR.

我用最简配置无法重现你说的问题:

$ emacs -Q --eval "\
  (progn
    (setq user-emacs-directory
          (car (seq-filter
                #'file-exists-p
                (list (format \"~/.emacs.d/%s/\" emacs-version)
                      (format \"~/.emacs.d/%s/\" emacs-major-version)
                      \"~/.emacs.d/\"))))

    (setq package-user-dir (concat user-emacs-directory \"elpa/\"))
    (package-initialize)
    (add-to-list 'load-path \"~/repos/emacs-lsp-bridge\")

    (setq custom-safe-themes t)
    (setq-default custom-enabled-themes '(tango))

    (defun reapply-themes()
      (load-theme 'tango))

    (add-hook 'emacs-startup-hook 'reapply-themes)

    (require 'yasnippet)
    (yas-global-mode 1)

    (require 'lsp-bridge)
    (global-lsp-bridge-mode))"

可能你的最简配置并未如你期望那般”最简“。

请问你加 --daemon 了吗?