From 729cd251233a2c49cb4b1fb4e426f7b4170e7249 Mon Sep 17 00:00:00 2001 From: BenjaminBrienen Date: Sat, 22 Mar 2025 17:54:46 +0100 Subject: [PATCH] Improve contributing/README.md --- .../docs/book/src/contributing/README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/tools/rust-analyzer/docs/book/src/contributing/README.md b/src/tools/rust-analyzer/docs/book/src/contributing/README.md index cbbf6acf3e59..9e1cdb08893f 100644 --- a/src/tools/rust-analyzer/docs/book/src/contributing/README.md +++ b/src/tools/rust-analyzer/docs/book/src/contributing/README.md @@ -3,7 +3,7 @@ rust-analyzer is an ordinary Rust project, which is organized as a Cargo workspace, builds on stable and doesn't depend on C libraries. So, just -``` +```bash $ cargo test ``` @@ -140,7 +140,7 @@ By default, log goes to stderr, but the stderr itself is processed by VS Code. `--log-file ` CLI argument allows logging to file. Setting the `RA_LOG_FILE=` environment variable will also log to file, it will also override `--log-file`. -To see stderr in the running VS Code instance, go to the "Output" tab of the panel and select `rust-analyzer`. +To see stderr in the running VS Code instance, go to the "Output" tab of the panel and select `Rust Analyzer Client`. This shows `eprintln!` as well. Note that `stdout` is used for the actual protocol, so `println!` will break things. @@ -148,7 +148,7 @@ To log all communication between the server and the client, there are two choice * You can log on the server side, by running something like - ``` + ```bash env RA_LOG=lsp_server=debug code . ``` @@ -180,7 +180,7 @@ There are also several VS Code commands which might be of interest: We have a built-in hierarchical profiler, you can enable it by using `RA_PROFILE` env-var: -``` +```bash RA_PROFILE=* // dump everything RA_PROFILE=foo|bar|baz // enabled only selected entries RA_PROFILE=*@3>10 // dump everything, up to depth 3, if it takes more than 10 ms @@ -191,7 +191,7 @@ Some rust-analyzer contributors have `export RA_PROFILE='*>10'` in my shell prof For machine-readable JSON output, we have the `RA_PROFILE_JSON` env variable. We support filtering only by span name: -``` +```bash RA_PROFILE=* // dump everything RA_PROFILE_JSON="vfs_load|parallel_prime_caches|discover_command" // dump selected spans ``` @@ -201,13 +201,13 @@ It is enabled by `RA_COUNT=1`. To measure time for from-scratch analysis, use something like this: -``` +```bash $ cargo run --release -p rust-analyzer -- analysis-stats ../chalk/ ``` For measuring time of incremental analysis, use either of these: -``` +```bash $ cargo run --release -p rust-analyzer -- analysis-bench ../chalk/ --highlight ../chalk/chalk-engine/src/logic.rs $ cargo run --release -p rust-analyzer -- analysis-bench ../chalk/ --complete ../chalk/chalk-engine/src/logic.rs:94:0 ``` @@ -220,7 +220,7 @@ Release process is handled by `release`, `dist`, `publish-release-notes` and `pr `release` assumes that you have checkouts of `rust-analyzer`, `rust-analyzer.github.io`, and `rust-lang/rust` in the same directory: -``` +```bash ./rust-analyzer ./rust-analyzer.github.io ./rust-rust-analyzer # Note the name!