From 547de2b161021bef3652283a30b8689c676eaacc Mon Sep 17 00:00:00 2001 From: Lukasz Anforowicz <anforowicz@users.noreply.github.com> Date: Fri, 1 Dec 2023 08:25:29 +0000 Subject: [PATCH] Chromium: Expand speaker notes for Rust Analyzer demo (#1537) --- src/chromium/build-rules/vscode.md | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/chromium/build-rules/vscode.md b/src/chromium/build-rules/vscode.md index 7cc4c9c6..9f819e2d 100644 --- a/src/chromium/build-rules/vscode.md +++ b/src/chromium/build-rules/vscode.md @@ -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> \ No newline at end of file + +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>