3269: Add inlay hints documentation r=flodiebold a=SomeoneToIgnore

Closes https://github.com/rust-analyzer/rust-analyzer/issues/3267

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
This commit is contained in:
bors[bot] 2020-02-22 11:50:36 +00:00 committed by GitHub
commit 9999660c90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -156,3 +156,28 @@ default highlighter.
Experimental feature that, given code highlighting using rust-analyzer is
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.
These contain extended information on the hovered language item.
* 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 exceeds the value specified. If no value is specified (`null`), no shortening is applied.
**Note:** VS Code does not have 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).