update vscode info

This commit is contained in:
Yu Chen
2022-07-14 16:32:33 +08:00
parent 698d75573e
commit 4ecc1fcf79

47
QA.md
View File

@@ -102,4 +102,49 @@ git push -f
**方法四:**
如果你能看到这个 QA说明相关 Pull request 已被 merge可以按 QA1 中方法更新仓库。
如果你能看到这个 QA说明相关 Pull request 已被 merge可以按 QA1 中方法更新仓库。
## Q8在用vscode的esbonio for Sphinxrst-->html,...和rust-analyzer插件时不能正常工作。请问如何配置
### A
**esbonio error找不到 conf.py 文件**
**解决方法**
在 .vscode/settings.json中添加如下内容
"esbonio.sphinx.confDir": "${workspaceFolder}/guide/source"
**rust-analyzer插件无法正常解析源代码中的相关定义**
比如 os/main.rs中有如下代码
#[cfg(feature = "board_k210")]
#[path = "boards/k210.rs"]
mod board;
#[cfg(not(any(feature = "board_k210")))]
#[path = "boards/qemu.rs"]
mod board;
这使得 mod board 可能是 k210.rs中的代码也可能是qemu.rs中的代码取决于编译时的参数即 os/Makefile 中的:
@cargo build --release --features "board_$(BOARD)"
rust-analyzer会报错unresolved import `crate::drivers::chardev::UART` 等错误
**解决方法**
在 .vscode/settings.json中添加如下内容
// Prevent "can't find crate for `test`" error on no_std
// Ref: https://github.com/rust-lang/vscode-rust/issues/729
// For vscode-rust plugin users:
"rust.target": "riscv64gc-unknown-none-elf",
"rust.all_targets": false,
// For Rust Analyzer plugin users:
"rust-analyzer.cargo.target": "riscv64gc-unknown-none-elf",
"rust-analyzer.checkOnSave.allTargets": false,
"rust-analyzer.cargo.features": [
"board_qemu"
]