diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-05-27 11:21:31 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-05-27 11:21:31 +0100 |
commit | 54bbbcf7226d946fe90f9dcabbb529ce1476bdf3 (patch) | |
tree | d5d4bc690c503c5f31118b1136d0437a30385265 | |
parent | 64a1c77ab279a2baddab25ae86698ece2bc146da (diff) | |
parent | bb415c1818fe75badbd70a87a4ae23923a3d3984 (diff) |
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]>
-rw-r--r-- | docs/dev/lsp-extensions.md | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/docs/dev/lsp-extensions.md b/docs/dev/lsp-extensions.md index 209f470eb..c898f3e93 100644 --- a/docs/dev/lsp-extensions.md +++ b/docs/dev/lsp-extensions.md | |||
@@ -362,3 +362,66 @@ interface ExpandedMacro { | |||
362 | ``` | 362 | ``` |
363 | 363 | ||
364 | Expands macro call at a given position. | 364 | 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 | ``` | ||