1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-05-28 21:27:37 +02:00

Chromium: Expand speaker notes for Rust Analyzer demo (#1537)

This commit is contained in:
Lukasz Anforowicz 2023-12-01 08:25:29 +00:00 committed by GitHub
parent f3e045ddf4
commit 547de2b161
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,6 +12,27 @@ for C++. Visual Studio code works well for Rust in Chromium. To use it,
<img src="vscode.png" style="border: 1px solid black;" alt="Example screenshot from VSCode">
<details>
A demo of some of the code annotation and exploration features of rust-analyzer might be
beneficial if the audience are naturally skeptical of IDEs.
</details>
The following steps may help with the demo (but feel free to instead use a piece
of Chromium-related Rust that you are most familiar with):
* Open `components/qr_code_generator/qr_code_generator_ffi_glue.rs`
* Place the cursor over the `QrCode::new` call (around line 26) in
`qr_code_generator_ffi_glue.rs
* Demo **show documentation** (typical bindings: vscode = ctrl k i; vim/CoC = K).
* Demo **go to definition** (typical bindings: vscode = F12; vim/CoC = g d).
(This will take you to `//third_party/rust/.../qr_code-.../src/lib.rs`.)
* Demo **outline** and navigate to the `QrCode::with_bits` method (around line
164; the outline is in the file explorer pane in vscode; typical vim/CoC
bindings = space o)
* Demo **type annotations** (there are quote a few nice examples in the
`QrCode::with_bits` method)
It may be worth pointing out that `gn gen ... --export-rust-project` will need
to be rerun after editing `BUILD.gn` files (which we will do a few times
throughout the exercises in this session).
</details>