diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-10-12 08:38:24 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-10-12 08:38:24 +0100 |
commit | 518f6d772482c7c58e59081f340947087a9b4800 (patch) | |
tree | d904f1b98cad63944b4c405238d8b3938a9debb9 /docs | |
parent | d5fcedb38eec33e2eb12ed550a9b90f6950855fe (diff) | |
parent | 3bd4fe96dce17eb2bff380389b24ea325bf54803 (diff) |
Merge #5917
5917: Add a command to open docs for the symbol under the cursor r=matklad a=zacps
#### Todo
- [ ] Decide if there should be a default keybind or context menu entry
- [x] Figure out how to get the documentation path for methods and other non-top-level defs
- [x] Design the protocol extension. In future we'll probably want parameters for local/remote documentation URLs, so that should maybe be done in this PR?
- [x] Code organisation
- [x] Tests
Co-authored-by: Zac Pullar-Strecker <[email protected]>
Diffstat (limited to 'docs')
-rw-r--r-- | docs/dev/lsp-extensions.md | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/docs/dev/lsp-extensions.md b/docs/dev/lsp-extensions.md index f1160bb1c..3f861f3e0 100644 --- a/docs/dev/lsp-extensions.md +++ b/docs/dev/lsp-extensions.md | |||
@@ -129,7 +129,7 @@ As a result of the command call the client will get the respective workspace edi | |||
129 | 129 | ||
130 | **Server Capability:** `{ "parentModule": boolean }` | 130 | **Server Capability:** `{ "parentModule": boolean }` |
131 | 131 | ||
132 | This request is send from client to server to handle "Goto Parent Module" editor action. | 132 | This request is sent from client to server to handle "Goto Parent Module" editor action. |
133 | 133 | ||
134 | **Method:** `experimental/parentModule` | 134 | **Method:** `experimental/parentModule` |
135 | 135 | ||
@@ -163,7 +163,7 @@ mod foo; | |||
163 | 163 | ||
164 | **Server Capability:** `{ "joinLines": boolean }` | 164 | **Server Capability:** `{ "joinLines": boolean }` |
165 | 165 | ||
166 | This request is send from client to server to handle "Join Lines" editor action. | 166 | This request is sent from client to server to handle "Join Lines" editor action. |
167 | 167 | ||
168 | **Method:** `experimental/joinLines` | 168 | **Method:** `experimental/joinLines` |
169 | 169 | ||
@@ -210,7 +210,7 @@ fn main() { | |||
210 | 210 | ||
211 | **Server Capability:** `{ "onEnter": boolean }` | 211 | **Server Capability:** `{ "onEnter": boolean }` |
212 | 212 | ||
213 | This request is send from client to server to handle <kbd>Enter</kbd> keypress. | 213 | This request is sent from client to server to handle <kbd>Enter</kbd> keypress. |
214 | 214 | ||
215 | **Method:** `experimental/onEnter` | 215 | **Method:** `experimental/onEnter` |
216 | 216 | ||
@@ -261,7 +261,7 @@ As proper cursor positioning is raison-d'etat for `onEnter`, it uses `SnippetTex | |||
261 | 261 | ||
262 | **Server Capability:** `{ "ssr": boolean }` | 262 | **Server Capability:** `{ "ssr": boolean }` |
263 | 263 | ||
264 | This request is send from client to server to handle structural search replace -- automated syntax tree based transformation of the source. | 264 | This request is sent from client to server to handle structural search replace -- automated syntax tree based transformation of the source. |
265 | 265 | ||
266 | **Method:** `experimental/ssr` | 266 | **Method:** `experimental/ssr` |
267 | 267 | ||
@@ -303,7 +303,7 @@ SSR with query `foo($a, $b) ==>> ($a).foo($b)` will transform, eg `foo(y + 5, z) | |||
303 | 303 | ||
304 | **Server Capability:** `{ "matchingBrace": boolean }` | 304 | **Server Capability:** `{ "matchingBrace": boolean }` |
305 | 305 | ||
306 | This request is send from client to server to handle "Matching Brace" editor action. | 306 | This request is sent from client to server to handle "Matching Brace" editor action. |
307 | 307 | ||
308 | **Method:** `experimental/matchingBrace` | 308 | **Method:** `experimental/matchingBrace` |
309 | 309 | ||
@@ -348,7 +348,7 @@ Moreover, it would be cool if editors didn't need to implement even basic langua | |||
348 | 348 | ||
349 | **Server Capability:** `{ "runnables": { "kinds": string[] } }` | 349 | **Server Capability:** `{ "runnables": { "kinds": string[] } }` |
350 | 350 | ||
351 | This request is send from client to server to get the list of things that can be run (tests, binaries, `cargo check -p`). | 351 | This request is sent from client to server to get the list of things that can be run (tests, binaries, `cargo check -p`). |
352 | 352 | ||
353 | **Method:** `experimental/runnables` | 353 | **Method:** `experimental/runnables` |
354 | 354 | ||
@@ -386,6 +386,17 @@ rust-analyzer supports only one `kind`, `"cargo"`. The `args` for `"cargo"` look | |||
386 | } | 386 | } |
387 | ``` | 387 | ``` |
388 | 388 | ||
389 | ## Open External Documentation | ||
390 | |||
391 | This request is sent from client to server to get a URL to documentation for the symbol under the cursor, if available. | ||
392 | |||
393 | **Method** `experimental/externalDocs` | ||
394 | |||
395 | **Request:**: `TextDocumentPositionParams` | ||
396 | |||
397 | **Response** `string | null` | ||
398 | |||
399 | |||
389 | ## Analyzer Status | 400 | ## Analyzer Status |
390 | 401 | ||
391 | **Method:** `rust-analyzer/analyzerStatus` | 402 | **Method:** `rust-analyzer/analyzerStatus` |
@@ -477,7 +488,7 @@ Expands macro call at a given position. | |||
477 | 488 | ||
478 | **Method:** `rust-analyzer/inlayHints` | 489 | **Method:** `rust-analyzer/inlayHints` |
479 | 490 | ||
480 | This request is send from client to server to render "inlay hints" -- virtual text inserted into editor to show things like inferred types. | 491 | This request is sent from client to server to render "inlay hints" -- virtual text inserted into editor to show things like inferred types. |
481 | Generally, the client should re-query inlay hints after every modification. | 492 | Generally, the client should re-query inlay hints after every modification. |
482 | 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. | 493 | 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. |
483 | Upstream issue: https://github.com/microsoft/language-server-protocol/issues/956 | 494 | Upstream issue: https://github.com/microsoft/language-server-protocol/issues/956 |