diff options
author | Aleksey Kladov <[email protected]> | 2020-05-27 11:20:47 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-05-27 11:20:47 +0100 |
commit | bb415c1818fe75badbd70a87a4ae23923a3d3984 (patch) | |
tree | b9e73d7779a920ed6f81c8e00e507300e905bbfe /docs | |
parent | dbb2c153ffad541474f2e5c7c7bd7ea93cf68f5f (diff) |
Document inlay hints and runnables
We want to change those, but let's document what we have in meantime
Diffstat (limited to 'docs')
-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 | ``` | ||