Skip to content

Commit 54bbbcf

Browse files
bors[bot]matklad
andauthored
Merge #4632
4632: Document inlay hints and runnables r=matklad a=matklad We want to change those, but let's document what we have in meantime bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
2 parents 64a1c77 + bb415c1 commit 54bbbcf

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

docs/dev/lsp-extensions.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,3 +362,66 @@ interface ExpandedMacro {
362362
```
363363

364364
Expands macro call at a given position.
365+
366+
## Inlay Hints
367+
368+
**Method:** `rust-analyzer/inlayHints`
369+
370+
This request is send from client to server to render "inlay hints" -- virtual text inserted into editor to show things like inferred types.
371+
Generally, the client should re-query inlay hints after every modification.
372+
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.
373+
Upstream issue: https://github.com/microsoft/language-server-protocol/issues/956
374+
375+
**Request:**
376+
377+
```typescript
378+
interface InlayHintsParams {
379+
textDocument: TextDocumentIdentifier,
380+
}
381+
```
382+
383+
**Response:** `InlayHint[]`
384+
385+
```typescript
386+
interface InlayHint {
387+
kind: "TypeHint" | "ParameterHint" | "ChainingHints",
388+
range: Range,
389+
label: string,
390+
}
391+
```
392+
393+
## Runnables
394+
395+
**Method:** `rust-analyzer/runnables`
396+
397+
This request is send from client to server to get the list of things that can be run (tests, binaries, `cargo check -p`).
398+
Note that we plan to move this request to `experimental/runnables`, as it is not really Rust-specific, but the current API is not necessary the right one.
399+
Upstream issue: https://github.com/microsoft/language-server-protocol/issues/944
400+
401+
**Request:**
402+
403+
```typescript
404+
interface RunnablesParams {
405+
textDocument: TextDocumentIdentifier;
406+
/// If null, compute runnables for the whole file.
407+
position?: Position;
408+
}
409+
```
410+
411+
**Response:** `Runnable[]`
412+
413+
```typescript
414+
interface Runnable {
415+
/// The range this runnable is applicable for.
416+
range: lc.Range;
417+
/// The label to show in the UI.
418+
label: string;
419+
/// The following fields describe a process to spawn.
420+
bin: string;
421+
args: string[];
422+
/// Args for cargo after `--`.
423+
extraArgs: string[];
424+
env: { [key: string]: string };
425+
cwd: string | null;
426+
}
427+
```

0 commit comments

Comments
 (0)