emacs lsp-mode There are no active servers in the current buffer

我从 https://github.com/TartanLlama/minidbg git clone 了cmake 项目代码; 因为包含子仓库,又运行 git submodule update --init --recursive ;

接着: guyuming@gymGentoo ~/minidbg $ cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1

我可以看到目录里生成了 compile_commands.json 但是如图 go to definition, find reference 菜单项都是灰的,我要是选 session->restart , 还会说 :user-error "There are no active servers in the current buffer

在 bash 里运行 which clangd 是有返回结果的

如何才能让 go to definition 菜单生效?

M-x lsp-docker 看下?感觉没有正确启动

我猜这问题会不会和那个cmake 项目以及生成的 compile_commands.json 有关.

我在别的目录新建一个类似 hello world 那样的.c 文件,lsp-workspace-folders-add 后,就没问题:

对于原来的 minidbg 项目,我尝试了下 M-x eglot , 貌似有些变化,如下图,底部会多出一个窗口

而且 xref-find-references 也能用了, 没用eglot 之前是不能用的,会提示我打开TAGS 文件. 但鼠标邮件弹出菜单里面还是灰的.

你说的 M-x lsp-docker 是其啥作用的?我运行了貌似没变化.

从 github 上获得了答案:https://github.com/emacs-lsp/lsp-mode/issues/2889

原来应该用 M-x lsp 而不是 M-x lsp-mode