aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/dev/lsp-extensions.md80
1 files changed, 44 insertions, 36 deletions
diff --git a/docs/dev/lsp-extensions.md b/docs/dev/lsp-extensions.md
index b7237ee90..647cf6107 100644
--- a/docs/dev/lsp-extensions.md
+++ b/docs/dev/lsp-extensions.md
@@ -311,6 +311,50 @@ Moreover, it would be cool if editors didn't need to implement even basic langua
311 This is how `SelectionRange` request works. 311 This is how `SelectionRange` request works.
312* Alternatively, should we perhaps flag certain `SelectionRange`s as being brace pairs? 312* Alternatively, should we perhaps flag certain `SelectionRange`s as being brace pairs?
313 313
314## Runnables
315
316**Issue:** https://github.com/microsoft/language-server-protocol/issues/944
317
318**Server Capability:** `{ "runnables": { "kinds": string[] } }`
319
320This request is send from client to server to get the list of things that can be run (tests, binaries, `cargo check -p`).
321
322**Method:** `experimental/runnables`
323
324**Request:**
325
326```typescript
327interface RunnablesParams {
328 textDocument: TextDocumentIdentifier;
329 /// If null, compute runnables for the whole file.
330 position?: Position;
331}
332```
333
334**Response:** `Runnable[]`
335
336```typescript
337interface Runnable {
338 label: string;
339 /// If this Runnable is associated with a specific function/module, etc, the location of this item
340 location?: LocationLink;
341 /// Running things is necessary technology specific, `kind` needs to be advertised via server capabilities,
342 // the type of `args` is specific to `kind`. The actual running is handled by the client.
343 kind: string;
344 args: any;
345}
346```
347
348rust-analyzer supports only one `kind`, `"cargo"`. The `args` for `"cargo"` look like this:
349
350```typescript
351{
352 workspaceRoot?: string;
353 cargoArgs: string[];
354 executableArgs: string[];
355}
356```
357
314## Analyzer Status 358## Analyzer Status
315 359
316**Method:** `rust-analyzer/analyzerStatus` 360**Method:** `rust-analyzer/analyzerStatus`
@@ -399,39 +443,3 @@ interface InlayHint {
399 label: string, 443 label: string,
400} 444}
401``` 445```
402
403## Runnables
404
405**Method:** `rust-analyzer/runnables`
406
407This request is send from client to server to get the list of things that can be run (tests, binaries, `cargo check -p`).
408Note 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.
409Upstream issue: https://github.com/microsoft/language-server-protocol/issues/944
410
411**Request:**
412
413```typescript
414interface RunnablesParams {
415 textDocument: TextDocumentIdentifier;
416 /// If null, compute runnables for the whole file.
417 position?: Position;
418}
419```
420
421**Response:** `Runnable[]`
422
423```typescript
424interface Runnable {
425 /// The range this runnable is applicable for.
426 range: lc.Range;
427 /// The label to show in the UI.
428 label: string;
429 /// The following fields describe a process to spawn.
430 kind: "cargo" | "rustc" | "rustup";
431 args: string[];
432 /// Args for cargo after `--`.
433 extraArgs: string[];
434 env: { [key: string]: string };
435 cwd: string | null;
436}
437```