Emacs:锈分析器 + 质朴 - 无法发现工作区



我是一个Arch Linux新手用户…我已经使用这个设置(emacs + rust + rust-analyzer + lsp-ui等设置,如https://robert.kra.hn/posts/rust-emacs-setup/)一个月了。昨天我试图从AUR安装anki包,但在构建后它不会使它的生活,所以我删除了整个东西使用sudo pacman -Rs anki,因为它安装了很多东西(包括rust平台出于某种原因),似乎在所有这些操作之后,rust平台停止与emacs一起工作…今天我试着使用像rustup组件添加rustcrustup组件remove/add rust-analyzer等等......它实际上重新安装了一些东西,但帮助不大。所以任何建议都是欢迎的:(

这里是我启动任何默认项目时的一些日志(通过cargo new——bin生成)):

[yas] Prepared just-in-time loading of snippets successfully.
Loading /home/geo/.emacs.d/custom.el (source)...done
For information about GNU Emacs and the GNU system, type C-h C-a.
C-<mouse-1> is undefined
Making completion list... [2 times]
LSP :: Connected to [rust-analyzer:9205/starting]. [2 times]
LSP :: rust-analyzer:9205 initialized successfully in folders: (/home/geo)
LSP :: rust-analyzer failed to discover workspace

我害怕说rust分析器在/home/geo文件夹中打开,但也许这只是我…

这是我的完整配置:https://github.com/geothecode/save/blob/laptop/.emacs.d/init.el

之前:一切都很好,没有错误,没有特定的警告-只是很好;我得到了lsp所需要的各种支持,lsp-ui正在工作(但现在停止显示)。

罗夏在评论中发布的解决方案对我很有效:

rust-analyzer应该init在您的项目文件夹-(1)删除错误的工作区(例如;(2)确保lsp-auto-guess-root为nil,(3)在你的项目中打开一个rust文件,以交互方式设置正确的工作空间根目录*

:不久

  1. lsp-workspace-folders-remove
  2. 设置lsp-auto-guess-rootnil
  3. 打开项目的rust文件

最新更新