VS Code 配置 Rust-Analyzer 报错

报错信息:

Bootstrap Error" rust-analyzer requires glibc >= 2.28 in latest build.

参考了好多地方,

https://github.com/rust-lang/rust-analyzer/issues/11558
https://blog.csdn.net/aLingYun/article/details/120923694
https://rust-analyzer.github.io/manual.html#vs-code

内容:

Summary of a workaround
the last working build: 0.2.948
the first broken build: 0.2.956
who is affected: anyone running Ubuntu < v.20

Option 1 - downgrade
1.Open the extension page in VS Code
2. Click on [V] next to Uninstall button
3. Select 0.2.948 and reload

Notes
You will be perpetually stuck on that version.

Option 2 - use pre-prelease via rustup
Install rust-analyzer-preview by running rustup toolchain install nightly --component rust-analyzer-preview
Go to VSCode settings and search for rust-analyzer.server.path. You should see something along these lines
image
Click on Edit in settings.json and add “rust-analyzer.server.path”: “~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rust-analyzer”
Reload VSCode

Notes
You will have to update the extension manually with rustup update
Even if rust-analyzer is built using nightly you can still use stable as your default channel
Component availability: https://rust-lang.github.io/rustup-components-history/
是把rust-analyzer 安装上了,但设置路径这一步一直不起效果。

最后偷梁换柱的方式成功了,用自己下载rust-analyzer 替换了VSCode 的 rust-analyzer ,成功了。

 $  ln -s ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rust-analyzer ~/.vscode-server/extensions/rust-lang.rust-analyzer-0.3.1566-linux-x64/server/rust-analyzer

后面发现,其实是应该该这里的文件 🤦‍。同样起作用。
在这里插入图片描述

配置rust-analyzer的代码提示,你可以按照以下步骤进行操作: 1. 确保已经在你的项目中安装了rust-analyzer插件。你可以在VSCode的插件市场中搜索并安装"rust-analyzer"插件。 2. 打开VSCode的设置(可以通过菜单栏的"文件" -> "首选项" -> "设置"或者使用快捷键Ctrl + ,打开设置)。 3. 在设置页面的搜索框中输入"rust-analyzer",找到相关的设置选项。 4. 根据你的需求,配置下列常用的代码提示相关的设置: - "rust-analyzer.enable": 设置为true以启用rust-analyzer插件。 - "rust-analyzer.completion.enable": 设置为true以启用代码补全功能。 - "rust-analyzer.completion.addCallArgumentSnippets": 设置为true以自动添加函数调用时的参数提示。 - "rust-analyzer.completion.addCallParenthesis": 设置为true以自动添加函数调用时的括号。 - "rust-analyzer.completion.postfix.enable": 设置为true以启用后缀代码补全功能,例如`.if`、`.let`等。 - "rust-analyzer.hover.enable": 设置为true以启用悬停提示功能。 - "rust-analyzer.inlayHints.enable": 设置为true以启用内联提示功能。 5. 根据你的需求,可以进一步自定义配置rust-analyzer的代码提示行为。你可以在设置中找到更多相关的选项,并根据注释进行配置。 6. 保存设置,并重启VSCode使更改生效。 通过以上步骤,你可以根据自己的喜好和需求来配置rust-analyzer的代码提示功能。请注意,具体的配置选项可能会因rust-analyzer插件版本的不同而有所差异,请参考插件的官方文档或参考其它资源获取更多定制化的配置信息。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值