From 51abdcaaf56936dbe75ce1436b7f50a5ade2c4b4 Mon Sep 17 00:00:00 2001 From: yea8er Date: Wed, 4 Feb 2026 11:45:07 +0300 Subject: [PATCH] docs: remove shell prompt symbols and fix code block languages --- src/tools/rust-analyzer/docs/book/README.md | 2 +- .../docs/book/src/contributing/README.md | 11 +++++----- .../docs/book/src/contributing/debugging.md | 2 +- .../docs/book/src/installation.md | 4 +++- .../docs/book/src/rust_analyzer_binary.md | 22 ++++++++++++------- .../docs/book/src/troubleshooting.md | 10 ++++----- .../rust-analyzer/docs/book/src/vs_code.md | 15 ++++++++----- 7 files changed, 40 insertions(+), 26 deletions(-) diff --git a/src/tools/rust-analyzer/docs/book/README.md b/src/tools/rust-analyzer/docs/book/README.md index 0a3161f3af38..cd4d8783a4d2 100644 --- a/src/tools/rust-analyzer/docs/book/README.md +++ b/src/tools/rust-analyzer/docs/book/README.md @@ -6,7 +6,7 @@ The rust analyzer manual uses [mdbook](https://rust-lang.github.io/mdBook/). To run the documentation site locally: -```shell +```bash cargo install mdbook cargo xtask codegen cd docs/book 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 c95a1dba6249..bb2b6081ad95 100644 --- a/src/tools/rust-analyzer/docs/book/src/contributing/README.md +++ b/src/tools/rust-analyzer/docs/book/src/contributing/README.md @@ -4,7 +4,7 @@ rust-analyzer is an ordinary Rust project, which is organized as a Cargo workspa So, just ```bash -$ cargo test +cargo test ``` should be enough to get you started! @@ -203,14 +203,14 @@ 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/ +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 +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 ``` Look for `fn benchmark_xxx` tests for a quick way to reproduce performance problems. @@ -283,7 +283,8 @@ repository. We use the [rustc-josh-sync](https://github.com/rust-lang/josh-sync) repositories. You can find documentation of the tool [here](https://github.com/rust-lang/josh-sync). You can install the synchronization tool using the following commands: -``` + +```bash cargo install --locked --git https://github.com/rust-lang/josh-sync ``` diff --git a/src/tools/rust-analyzer/docs/book/src/contributing/debugging.md b/src/tools/rust-analyzer/docs/book/src/contributing/debugging.md index fcda664f5ed3..ace9be025ab4 100644 --- a/src/tools/rust-analyzer/docs/book/src/contributing/debugging.md +++ b/src/tools/rust-analyzer/docs/book/src/contributing/debugging.md @@ -68,7 +68,7 @@ while d == 4 { // set a breakpoint here and change the value However for this to work, you will need to enable debug_assertions in your build -```rust +```bash RUSTFLAGS='--cfg debug_assertions' cargo build --release ``` diff --git a/src/tools/rust-analyzer/docs/book/src/installation.md b/src/tools/rust-analyzer/docs/book/src/installation.md index 3a4c0cf22774..cc636c31e6ec 100644 --- a/src/tools/rust-analyzer/docs/book/src/installation.md +++ b/src/tools/rust-analyzer/docs/book/src/installation.md @@ -13,7 +13,9 @@ editor](./other_editors.html). rust-analyzer will attempt to install the standard library source code automatically. You can also install it manually with `rustup`. - $ rustup component add rust-src +```bash +rustup component add rust-src +``` Only the latest stable standard library source is officially supported for use with rust-analyzer. If you are using an older toolchain or have diff --git a/src/tools/rust-analyzer/docs/book/src/rust_analyzer_binary.md b/src/tools/rust-analyzer/docs/book/src/rust_analyzer_binary.md index c7ac3087ced7..85fa4119d623 100644 --- a/src/tools/rust-analyzer/docs/book/src/rust_analyzer_binary.md +++ b/src/tools/rust-analyzer/docs/book/src/rust_analyzer_binary.md @@ -11,9 +11,11 @@ your `$PATH`. On Linux to install the `rust-analyzer` binary into `~/.local/bin`, these commands should work: - $ mkdir -p ~/.local/bin - $ curl -L https://github.com/rust-lang/rust-analyzer/releases/latest/download/rust-analyzer-x86_64-unknown-linux-gnu.gz | gunzip -c - > ~/.local/bin/rust-analyzer - $ chmod +x ~/.local/bin/rust-analyzer +```bash +mkdir -p ~/.local/bin +curl -L https://github.com/rust-lang/rust-analyzer/releases/latest/download/rust-analyzer-x86_64-unknown-linux-gnu.gz | gunzip -c - > ~/.local/bin/rust-analyzer +chmod +x ~/.local/bin/rust-analyzer +``` Make sure that `~/.local/bin` is listed in the `$PATH` variable and use the appropriate URL if you’re not on a `x86-64` system. @@ -24,8 +26,8 @@ or `/usr/local/bin` will work just as well. Alternatively, you can install it from source using the command below. You’ll need the latest stable version of the Rust toolchain. - $ git clone https://github.com/rust-lang/rust-analyzer.git && cd rust-analyzer - $ cargo xtask install --server + git clone https://github.com/rust-lang/rust-analyzer.git && cd rust-analyzer + cargo xtask install --server If your editor can’t find the binary even though the binary is on your `$PATH`, the likely explanation is that it doesn’t see the same `$PATH` @@ -38,7 +40,9 @@ the environment should help. `rust-analyzer` is available in `rustup`: - $ rustup component add rust-analyzer +```bash +rustup component add rust-analyzer +``` ### Arch Linux @@ -53,7 +57,7 @@ User Repository): Install it with pacman, for example: - $ pacman -S rust-analyzer + pacman -S rust-analyzer ### Gentoo Linux @@ -64,7 +68,9 @@ Install it with pacman, for example: The `rust-analyzer` binary can be installed via [Homebrew](https://brew.sh/). - $ brew install rust-analyzer +```bash +brew install rust-analyzer +``` ### Windows diff --git a/src/tools/rust-analyzer/docs/book/src/troubleshooting.md b/src/tools/rust-analyzer/docs/book/src/troubleshooting.md index a357cbef415c..c315bfad7f94 100644 --- a/src/tools/rust-analyzer/docs/book/src/troubleshooting.md +++ b/src/tools/rust-analyzer/docs/book/src/troubleshooting.md @@ -37,13 +37,13 @@ bypassing LSP machinery. When filing issues, it is useful (but not necessary) to try to minimize examples. An ideal bug reproduction looks like this: -```shell -$ git clone https://github.com/username/repo.git && cd repo && git switch --detach commit-hash -$ rust-analyzer --version +```bash +git clone https://github.com/username/repo.git && cd repo && git switch --detach commit-hash +rust-analyzer --version rust-analyzer dd12184e4 2021-05-08 dev -$ rust-analyzer analysis-stats . -💀 💀 💀 +rust-analyzer analysis-stats . ``` +💀 💀 💀 It is especially useful when the `repo` doesn’t use external crates or the standard library. diff --git a/src/tools/rust-analyzer/docs/book/src/vs_code.md b/src/tools/rust-analyzer/docs/book/src/vs_code.md index 233b862d2c6b..75f940e69a88 100644 --- a/src/tools/rust-analyzer/docs/book/src/vs_code.md +++ b/src/tools/rust-analyzer/docs/book/src/vs_code.md @@ -49,7 +49,9 @@ Alternatively, download a VSIX corresponding to your platform from the Install the extension with the `Extensions: Install from VSIX` command within VS Code, or from the command line via: - $ code --install-extension /path/to/rust-analyzer.vsix +```bash +code --install-extension /path/to/rust-analyzer.vsix +``` If you are running an unsupported platform, you can install `rust-analyzer-no-server.vsix` and compile or obtain a server binary. @@ -64,8 +66,10 @@ example: Both the server and the Code plugin can be installed from source: - $ git clone https://github.com/rust-lang/rust-analyzer.git && cd rust-analyzer - $ cargo xtask install +```bash +git clone https://github.com/rust-lang/rust-analyzer.git && cd rust-analyzer +cargo xtask install +``` You’ll need Cargo, nodejs (matching a supported version of VS Code) and npm for this. @@ -76,7 +80,9 @@ Remote, instead you’ll need to install the `.vsix` manually. If you’re not using Code, you can compile and install only the LSP server: - $ cargo xtask install --server +```bash +cargo xtask install --server +``` Make sure that `.cargo/bin` is in `$PATH` and precedes paths where `rust-analyzer` may also be installed. Specifically, `rustup` includes a @@ -118,4 +124,3 @@ steps might help: A C compiler should already be available via `org.freedesktop.Sdk`. Any other tools or libraries you will need to acquire from Flatpak. -