hhstore / blog

My Tech Blog: about Mojo / Rust / Golang / Python / Kotlin / Flutter / VueJS / Blockchain etc.
https://github.com/hhstore/blog/issues
292 stars 24 forks source link

Rust: with Clion/IntelliJ IDEA Community/Vscode #390

Open hhstore opened 2 years ago

hhstore commented 2 years ago

related:

hhstore commented 2 years ago

Rust 开发环境搭建:

基本步骤:

PS:


安装 IntelliJ IDEA Community 社区版 + intellij-rust 插件,
然后 action 开启 `org.rust.cargo.evaluate.build.scripts` 选项。 
也是支持宏代码跳转的。亲测有效。依然比 vscode + ra 强大。

使用 rustup 安装 rust:


curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

查看安装 rust 版本:


➤ rustup show
Default host: aarch64-apple-darwin
rustup home:  /Users/dev/.rustup

installed toolchains
--------------------

stable-aarch64-apple-darwin
nightly-2022-07-31-aarch64-apple-darwin
nightly-aarch64-apple-darwin (default)
1.61.0-aarch64-apple-darwin

active toolchain
----------------

nightly-aarch64-apple-darwin (default)
rustc 1.63.0-nightly (12cd71f4d 2022-06-01)

➤ cargo version
cargo 1.63.0-nightly (38472bc19 2022-05-31)

验证 IDE 宏补全 - 示例项目:

image

Rust LSP - rust-analyzer: for Vscode

pb 生成代码补全:

intellij-rust 代码补全 - 核心设置: for Clion

org.rust.cargo.evaluate.build.scripts = true
hhstore commented 2 years ago

Rust 配置 Clion 开发环境:

基本设置:

image

项目主动激活索引:

image

激活宏生成的代码补全:

org.rust.cargo.evaluate.build.scripts

说明:

具体步骤:

image image image

配置成功的效果:

rx2IKRCVlN

xsmQSWuYLt

hhstore commented 2 years ago

Rust 配置 Vscode:

插件配置:

rust-analyzer:

生成代码补全支持:

hhstore commented 2 years ago

clion 的宏补全能力:

NECmKRXQXw

hhstore commented 2 years ago

Clion index 炸机修复:


# clion功能不行的时候,用这个命令:
cargo metadata --verbose --format-version 1 --all-features
hhstore commented 2 years ago

1

hhstore commented 2 years ago

1