我已经在Windows 10上安装了Anaconda 3和VS Code。我对在笔记本上运行Rust很感兴趣,我发现CodeBook似乎符合要求。我在conda create -n rust_env -c conda-forge rust
环境中使用conda安装了Rust,然后在VS Code中安装了rust-analyzer
扩展,并创建了一个标记文档,我在CodeBook中打开了该文档。
但是,当我尝试运行一个单元格时,我发现rust-analyzer
已经扫描了0个根中的0个,并且“未能加载工作空间”cargo“-未找到程序”。
如果我在终端中使用conda激活rustenv
,我可以运行cargo --version
,但似乎CodeBook没有在正确的环境中运行Rust。
我在铁 rust 分析仪手册中找不到任何帮助:https://rust-analyzer.github.io/manual.html
VS代码显示终端中的conda环境
更新:我已经将rust可执行文件添加到路径中:C:\ProgramData\Anaconda3\envs\rustenv\Library\bin
现在出现服务器错误...
[Info - 2:10:43 pm] Connection to server got closed. Server will restart.
[Error - 2:10:43 pm] Server initialization failed.
Message: Pending response rejected since connection got disposed
Code: -32097
[Error - 2:10:43 pm] Rust Analyzer Language Server client: couldn't create connection to server.
Message: Pending response rejected since connection got disposed
Code: -32097
[Error - 2:10:43 pm] Restarting server failed
Message: Pending response rejected since connection got disposed
Code: -32097
[Info - 2:10:45 pm] Connection to server got closed. Server will restart.
[Error - 2:10:45 pm] Server initialization failed.
Message: Pending response rejected since connection got disposed
Code: -32097
[Error - 2:10:45 pm] Rust Analyzer Language Server client: couldn't create connection to server.
Message: Pending response rejected since connection got disposed
Code: -32097
[Error - 2:10:45 pm] Restarting server failed
Message: Pending response rejected since connection got disposed
Code: -32097
[Error - 2:10:45 pm] The Rust Analyzer Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
我不明白这是什么意思...
1条答案
按热度按时间zpf6vheq1#
我的经验是,不幸的是,VS代码不能很好地与康达生 rust 。你将不得不改变设置在多个地方,我实际上从来没有得到它的工作自己。
最好在您的系统上安装rust而不使用conda,然后VS Code中的一切都可以开箱即用。