mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 21:43:37 +00:00
Add inlay hints documentation
This commit is contained in:
parent
baf832d6d9
commit
64051ac5c7
1 changed files with 25 additions and 0 deletions
|
@ -156,3 +156,28 @@ default highlighter.
|
||||||
|
|
||||||
Experimental feature that, given code highlighting using rust-analyzer is
|
Experimental feature that, given code highlighting using rust-analyzer is
|
||||||
active, will pick unique colors for identifiers.
|
active, will pick unique colors for identifiers.
|
||||||
|
|
||||||
|
### Code hints
|
||||||
|
|
||||||
|
Rust Analyzer has two types of hints to show the information about the code:
|
||||||
|
|
||||||
|
* hover hints, appearing on hover on any element.
|
||||||
|
|
||||||
|
Contains extended information on the language item hovered.
|
||||||
|
|
||||||
|
* inlay hints, shown near the element hinted directly in the editor.
|
||||||
|
|
||||||
|
Two types of inlay hints are displayed currently:
|
||||||
|
|
||||||
|
* type hints, displaying the minimal information on the type of the expression (if the information is available)
|
||||||
|
* parameter name hints, displaying the names of the parameters in the corresponding methods
|
||||||
|
|
||||||
|
#### VS Code
|
||||||
|
|
||||||
|
In VS Code, the following settings can be used to configure the inlay hints:
|
||||||
|
|
||||||
|
* rust-analyzer.displayInlayHints — toggles inlay hints display on or off
|
||||||
|
* rust-analyzer.maxInlayHintLength — shortens the hints if their length exceed the value specified. If no value is specified (`null`), no shorteninng is applied.
|
||||||
|
|
||||||
|
**Note:** VS Code does not have a native support for inlay hints [yet](https://github.com/microsoft/vscode/issues/16221) and the hints are implemented using decorations.
|
||||||
|
This approach has limitations: the caret movement near the end of the hint may look [weird](https://github.com/rust-analyzer/rust-analyzer/issues/1623).
|
||||||
|
|
Loading…
Reference in a new issue