From 64051ac5c7af84116e200b8e3adecffdf81f3fb4 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Sat, 22 Feb 2020 10:23:03 +0300 Subject: [PATCH 1/4] Add inlay hints documentation --- docs/user/features.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/docs/user/features.md b/docs/user/features.md index f705e511550..1c18d3ae173 100644 --- a/docs/user/features.md +++ b/docs/user/features.md @@ -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. + +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). From 68c34d1f638c90350d28376d68971e811b80a660 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Sat, 22 Feb 2020 12:51:08 +0200 Subject: [PATCH 2/4] Code review fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Florian Diebold Co-Authored-By: Laurențiu Nicola --- docs/user/features.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/user/features.md b/docs/user/features.md index 1c18d3ae173..ef58393cd5f 100644 --- a/docs/user/features.md +++ b/docs/user/features.md @@ -159,11 +159,11 @@ active, will pick unique colors for identifiers. ### Code hints -Rust Analyzer has two types of hints to show the information about the code: +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. +These contain extended information on the hovered language item. * inlay hints, shown near the element hinted directly in the editor. @@ -176,8 +176,8 @@ Two types of inlay hints are displayed currently: 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. +* `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 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. +**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). From 6f8d70363d0860aa84665910568ed5a9b53b1bc8 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Sat, 22 Feb 2020 13:52:49 +0300 Subject: [PATCH 3/4] One more tiny doc fix --- docs/user/features.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user/features.md b/docs/user/features.md index ef58393cd5f..e0735dcd87c 100644 --- a/docs/user/features.md +++ b/docs/user/features.md @@ -177,7 +177,7 @@ Two types of inlay hints are displayed currently: 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 shorteninng is applied. +* `rust-analyzer.maxInlayHintLength` — shortens the hints if their length exceeds the value specified. If no value is specified (`null`), no shorteninng 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). From 818a4ea27225a4176fb191bed5eb329c807045a7 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Sat, 22 Feb 2020 14:35:48 +0300 Subject: [PATCH 4/4] Fix a typo --- docs/user/features.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user/features.md b/docs/user/features.md index e0735dcd87c..a9cff34d22c 100644 --- a/docs/user/features.md +++ b/docs/user/features.md @@ -177,7 +177,7 @@ Two types of inlay hints are displayed currently: 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 shorteninng is applied. +* `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).