@@ -223,7 +223,7 @@ image::https://user-images.githubusercontent.com/48062697/113020654-b42fc800-917
223
223
224
224
225
225
=== Find All References
226
- **Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide/src/references.rs#L44 [references.rs]
226
+ **Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide/src/references.rs#L42 [references.rs]
227
227
228
228
Shows all references of the item at the cursor location
229
229
@@ -270,7 +270,7 @@ Navigates to the declaration of an identifier.
270
270
271
271
This is the same as `Go to Definition` with the following exceptions:
272
272
- outline modules will navigate to the `mod name;` item declaration
273
- - trait assoc items will navigate to the assoc item of the trait declaration opposed to the trait impl
273
+ - trait assoc items will navigate to the assoc item of the trait declaration as opposed to the trait impl
274
274
- fields in patterns will navigate to the field declaration of the struct, union or variant
275
275
276
276
@@ -334,7 +334,7 @@ Note: `?`, `|` and `->` do not currently trigger this behavior in the VSCode edi
334
334
335
335
336
336
=== Hover
337
- **Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide/src/hover.rs#L98 [hover.rs]
337
+ **Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide/src/hover.rs#L101 [hover.rs]
338
338
339
339
Shows additional information, like the type of an expression or the documentation for a definition when "focusing" code.
340
340
Focusing is usually hovering with a mouse, but can also be triggered with a shortcut.
@@ -343,7 +343,7 @@ image::https://user-images.githubusercontent.com/48062697/113020658-b5f98b80-917
343
343
344
344
345
345
=== Inlay Hints
346
- **Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide/src/inlay_hints.rs#L433 [inlay_hints.rs]
346
+ **Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide/src/inlay_hints.rs#L441 [inlay_hints.rs]
347
347
348
348
rust-analyzer shows additional information inline with the source code.
349
349
Editors usually render this using read-only virtual text snippets interspersed with code.
@@ -360,6 +360,23 @@ Optionally, one can enable additional hints for
360
360
* elided lifetimes
361
361
* compiler inserted reborrows
362
362
363
+ Note: inlay hints for function argument names are heuristically omitted to reduce noise and will not appear if
364
+ any of the
365
+ link:https://github.com/rust-lang/rust-analyzer/blob/6b8b8ff4c56118ddee6c531cde06add1aad4a6af/crates/ide/src/inlay_hints/param_name.rs#L92-L99[following criteria]
366
+ are met:
367
+
368
+ * the parameter name is a suffix of the function's name
369
+ * the argument is a qualified constructing or call expression where the qualifier is an ADT
370
+ * exact argument<->parameter match(ignoring leading underscore) or parameter is a prefix/suffix
371
+ of argument with _ splitting it off
372
+ * the parameter name starts with `ra_fixture`
373
+ * the parameter name is a
374
+ link:https://github.com/rust-lang/rust-analyzer/blob/6b8b8ff4c56118ddee6c531cde06add1aad4a6af/crates/ide/src/inlay_hints/param_name.rs#L200[well known name]
375
+ in a unary function
376
+ * the parameter name is a
377
+ link:https://github.com/rust-lang/rust-analyzer/blob/6b8b8ff4c56118ddee6c531cde06add1aad4a6af/crates/ide/src/inlay_hints/param_name.rs#L201[single character]
378
+ in a unary function
379
+
363
380
image::https://user-images.githubusercontent.com/48062697/113020660-b5f98b80-917a-11eb-8d70-3be3fd558cdd.png[]
364
381
365
382
@@ -392,7 +409,7 @@ image::https://user-images.githubusercontent.com/48062697/113020661-b6922200-917
392
409
393
410
394
411
=== Magic Completions
395
- **Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-completion/src/lib.rs#L45 [lib.rs]
412
+ **Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-completion/src/lib.rs#L44 [lib.rs]
396
413
397
414
In addition to usual reference completion, rust-analyzer provides some ✨magic✨
398
415
completions as well:
@@ -414,6 +431,7 @@ There are postfix completions, which can be triggered by typing something like
414
431
- `expr.ref` -> `&expr`
415
432
- `expr.refm` -> `&mut expr`
416
433
- `expr.let` -> `let $0 = expr;`
434
+ - `expr.lete` -> `let $1 = expr else { $0 };`
417
435
- `expr.letm` -> `let mut $0 = expr;`
418
436
- `expr.not` -> `!expr`
419
437
- `expr.dbg` -> `dbg!(expr)`
@@ -556,7 +574,7 @@ image::https://user-images.githubusercontent.com/48062697/113171066-105c2000-923
556
574
557
575
558
576
=== Open Docs
559
- **Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide/src/doc_links.rs#L122 [doc_links.rs]
577
+ **Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide/src/doc_links.rs#L120 [doc_links.rs]
560
578
561
579
Retrieve a links to documentation for the given symbol.
562
580
@@ -585,7 +603,7 @@ image::https://user-images.githubusercontent.com/48062697/113065580-04c21800-91b
585
603
586
604
587
605
=== Related Tests
588
- **Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide/src/runnables.rs#L195 [runnables.rs]
606
+ **Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide/src/runnables.rs#L213 [runnables.rs]
589
607
590
608
Provides a sneak peek of all tests where the current item is used.
591
609
@@ -600,7 +618,7 @@ the selected item. The context menu opens. Select **Peek Related Tests**.
600
618
601
619
602
620
=== Rename
603
- **Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide/src/rename.rs#L72 [rename.rs]
621
+ **Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide/src/rename.rs#L73 [rename.rs]
604
622
605
623
Renames the item below the cursor and all of its references
606
624
@@ -614,7 +632,7 @@ image::https://user-images.githubusercontent.com/48062697/113065582-055aae80-91b
614
632
615
633
616
634
=== Run
617
- **Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide/src/runnables.rs#L111 [runnables.rs]
635
+ **Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide/src/runnables.rs#L113 [runnables.rs]
618
636
619
637
Shows a popup suggesting to run a test/benchmark/binary **at the current cursor
620
638
location**. Super useful for repeatedly running just a single test. Do bind this
@@ -790,7 +808,7 @@ Randomizes all crate IDs in the crate graph, for debugging.
790
808
791
809
792
810
=== Status
793
- **Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide/src/status.rs#L28 [status.rs]
811
+ **Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide/src/status.rs#L27 [status.rs]
794
812
795
813
Shows internal statistic about memory usage of rust-analyzer.
796
814
@@ -803,7 +821,7 @@ image::https://user-images.githubusercontent.com/48062697/113065584-05f34500-91b
803
821
804
822
805
823
=== Structural Search and Replace
806
- **Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-ssr/src/lib.rs#L8 [lib.rs]
824
+ **Source:** https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide-ssr/src/lib.rs#L6 [lib.rs]
807
825
808
826
Search and replace with named wildcards that will match any expression, type, path, pattern or item.
809
827
The syntax for a structural search replace command is `<search_pattern> ==>> <replace_pattern>`.
@@ -1036,7 +1054,8 @@ workspace to dependencies.
1036
1054
Note that filtering does not currently work in VSCode due to the editor never
1037
1055
sending the special symbols to the language server. Instead, you can configure
1038
1056
the filtering via the `rust-analyzer.workspace.symbol.search.scope` and
1039
- `rust-analyzer.workspace.symbol.search.kind` settings.
1057
+ `rust-analyzer.workspace.symbol.search.kind` settings. Symbols prefixed
1058
+ with `__` are hidden from the search results unless configured otherwise.
1040
1059
1041
1060
|===
1042
1061
| Editor | Shortcut
0 commit comments