mirror of
https://github.com/Cuprate/cuprate.git
synced 2024-11-16 15:58:17 +00:00
Adding development environment advices (#49)
* added ws dev advices * removed nightly rustfmt
This commit is contained in:
parent
ec4fe9b79d
commit
47238fbef3
1 changed files with 90 additions and 0 deletions
90
misc/ENVIRONMENT-ADIVE.md
Normal file
90
misc/ENVIRONMENT-ADIVE.md
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
# Development environment advice
|
||||||
|
|
||||||
|
This documentation contain advice for setting up the development environment.
|
||||||
|
|
||||||
|
Cuprate is a rust project, and therefore inherit the use of the default of LSP plugin Rust-analyzer. Rust-analyzer is well conceived but can be
|
||||||
|
slow on big project such as Cuprate.
|
||||||
|
|
||||||
|
Here are following suggested configurations from Polkadot-SDK's documentation:
|
||||||
|
|
||||||
|
### Rust-analyzer's VSCode plugin:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
// Use a separate target dir for Rust Analyzer. Helpful if you want to use Rust
|
||||||
|
// Analyzer and cargo on the command line at the same time.
|
||||||
|
"rust-analyzer.rust.analyzerTargetDir": "target/vscode-rust-analyzer",
|
||||||
|
// Improve stability
|
||||||
|
"rust-analyzer.server.extraEnv": {
|
||||||
|
"CHALK_OVERFLOW_DEPTH": "100000000",
|
||||||
|
"CHALK_SOLVER_MAX_SIZE": "10000000"
|
||||||
|
},
|
||||||
|
// Check feature-gated code
|
||||||
|
"rust-analyzer.cargo.features": "all",
|
||||||
|
"rust-analyzer.cargo.extraEnv": {
|
||||||
|
// Skip building WASM, there is never need for it here
|
||||||
|
"SKIP_WASM_BUILD": "1"
|
||||||
|
},
|
||||||
|
// Don't expand some problematic proc_macros
|
||||||
|
"rust-analyzer.procMacro.ignored": {
|
||||||
|
"async-trait": ["async_trait"],
|
||||||
|
"napi-derive": ["napi"],
|
||||||
|
"async-recursion": ["async_recursion"],
|
||||||
|
"async-std": ["async_std"]
|
||||||
|
},
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Rust-analyzer's Neovim LUA plugin:
|
||||||
|
|
||||||
|
```lua
|
||||||
|
["rust-analyzer"] = {
|
||||||
|
rust = {
|
||||||
|
# Use a separate target dir for Rust Analyzer. Helpful if you want to use Rust
|
||||||
|
# Analyzer and cargo on the command line at the same time.
|
||||||
|
analyzerTargetDir = "target/nvim-rust-analyzer",
|
||||||
|
},
|
||||||
|
server = {
|
||||||
|
# Improve stability
|
||||||
|
extraEnv = {
|
||||||
|
["CHALK_OVERFLOW_DEPTH"] = "100000000",
|
||||||
|
["CHALK_SOLVER_MAX_SIZE"] = "100000000",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
cargo = {
|
||||||
|
# Check feature-gated code
|
||||||
|
features = "all",
|
||||||
|
extraEnv = {
|
||||||
|
# Skip building WASM, there is never need for it here
|
||||||
|
["SKIP_WASM_BUILD"] = "1",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
procMacro = {
|
||||||
|
# Don't expand some problematic proc_macros
|
||||||
|
ignored = {
|
||||||
|
["async-trait"] = { "async_trait" },
|
||||||
|
["napi-derive"] = { "napi" },
|
||||||
|
["async-recursion"] = { "async_recursion" },
|
||||||
|
["async-std"] = { "async_std" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
```
|
||||||
|
|
||||||
|
### Usage of cargo -p
|
||||||
|
|
||||||
|
Prefer to use cargo -p <CRATE> while possible, as any cargo in workspace mode will check and build dependencies of every crates in the repository.
|
||||||
|
|
||||||
|
On Rust-analyzer's VSCode plugin, you can add the following configuration if you're focused on one specific crate:
|
||||||
|
|
||||||
|
```json
|
||||||
|
"rust-analyzer.check.extraArgs": [
|
||||||
|
"-p <CRATE_NAME>"
|
||||||
|
],
|
||||||
|
```
|
||||||
|
|
||||||
|
### Alternative IDE
|
||||||
|
|
||||||
|
If you still deal with lags on VSCode or Neovim, you could try the following IDE:
|
||||||
|
- RustRover: It have been reported to have excellent performance at managing huge workspace. It use its own fine-tuned plugins by jetbrains.
|
||||||
|
- Zed: Rust-written IDE focused on performance. Still in beta and macOS only.
|
Loading…
Reference in a new issue