about summary refs log tree commit diff
path: root/docs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2022-03-07 16:49:12 +0000
committerGitHub <noreply@github.com>2022-03-07 16:49:12 +0000
commit49646b71d49cc3c94aa0105223be0ff71cbb6b7d (patch)
tree533597081181df411cf4c043152f65a55f4f03dd /docs
parent18d0faf027a0ea2808b842f2dfbd7b7e12438f44 (diff)
parent88a2141b7702a553050dc46653251550300e6269 (diff)
downloadrust-49646b71d49cc3c94aa0105223be0ff71cbb6b7d.tar.gz
rust-49646b71d49cc3c94aa0105223be0ff71cbb6b7d.zip
Merge #11445
11445: Upstream inlay hints r=lnicola a=lnicola

Closes https://github.com/rust-analyzer/rust-analyzer/issues/2797
Closes https://github.com/rust-analyzer/rust-analyzer/issues/3394 (since now resolve the hints for the range given only, not for the whole document. We don't actually resolve anything due to [hard requirement](https://github.com/rust-analyzer/rust-analyzer/pull/11445#issuecomment-1035227434) on label being immutable. Any further heavy actions could go to the `resolve` method that's now available via the official Code API for hints)

Based on `@SomeoneToIgnore's` branch, with a couple of updates:

 - I squashed, more or less successfully, the commits on that branch
 - downloading the `.d.ts` no longer works, but you can get it manually from https://raw.githubusercontent.com/microsoft/vscode/release/1.64/src/vscode-dts/vscode.proposed.inlayHints.d.ts
 - you might need to pass `--enable-proposed-api matklad.rust-analyzer`
 - if I'm reading the definition right, `InlayHintKind` needs to be serialized as a number, not string
 - this doesn't work anyway -- the client-side gets the hints, but they don't display

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Diffstat (limited to 'docs')
-rw-r--r--docs/dev/lsp-extensions.md15
1 files changed, 9 insertions, 6 deletions
diff --git a/docs/dev/lsp-extensions.md b/docs/dev/lsp-extensions.md
index 85df1188a8a..9f1c7fe0a3a 100644
--- a/docs/dev/lsp-extensions.md
+++ b/docs/dev/lsp-extensions.md
@@ -1,5 +1,5 @@
 <!---
-lsp_ext.rs hash: 5b53b92c9f9d6650
+lsp_ext.rs hash: e32fdde032ff6ebc
 
 If you need to change the above hash to make the test pass, please check if you
 need to adjust this doc as well and ping this issue:
@@ -562,11 +562,11 @@ Expands macro call at a given position.
 
 ## Inlay Hints
 
-**Method:** `rust-analyzer/inlayHints`
+**Method:** `experimental/inlayHints`
 
 This request is sent from client to server to render "inlay hints" -- virtual text inserted into editor to show things like inferred types.
 Generally, the client should re-query inlay hints after every modification.
-Note that we plan to move this request to `experimental/inlayHints`, as it is not really Rust-specific, but the current API is not necessary the right one.
+Until it gets upstreamed, this follows the VS Code API.
 Upstream issues: https://github.com/microsoft/language-server-protocol/issues/956 , https://github.com/rust-analyzer/rust-analyzer/issues/2797
 
 **Request:**
@@ -581,9 +581,12 @@ interface InlayHintsParams {
 
 ```typescript
 interface InlayHint {
-    kind: "TypeHint" | "ParameterHint" | "ChainingHint",
-    range: Range,
-    label: string,
+    position: Position;
+    label: string | InlayHintLabelPart[];
+    tooltip?: string | MarkdownString | undefined;
+    kind?: InlayHintKind;
+    paddingLeft?: boolean;
+    paddingRight?: boolean;
 }
 ```