diff options
Diffstat (limited to 'docs/dev/lsp-extensions.md')
-rw-r--r-- | docs/dev/lsp-extensions.md | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/docs/dev/lsp-extensions.md b/docs/dev/lsp-extensions.md index 73be59a82..a46121bb2 100644 --- a/docs/dev/lsp-extensions.md +++ b/docs/dev/lsp-extensions.md | |||
@@ -1,5 +1,5 @@ | |||
1 | <!--- | 1 | <!--- |
2 | lsp_ext.rs hash: e8a7502bd2b2c2f5 | 2 | lsp_ext.rs hash: faae991334a151d0 |
3 | 3 | ||
4 | If you need to change the above hash to make the test pass, please check if you | 4 | If you need to change the above hash to make the test pass, please check if you |
5 | need to adjust this doc as well and ping this issue: | 5 | need to adjust this doc as well and ping this issue: |
@@ -51,8 +51,8 @@ interface SnippetTextEdit extends TextEdit { | |||
51 | 51 | ||
52 | ```typescript | 52 | ```typescript |
53 | export interface TextDocumentEdit { | 53 | export interface TextDocumentEdit { |
54 | textDocument: OptionalVersionedTextDocumentIdentifier; | 54 | textDocument: OptionalVersionedTextDocumentIdentifier; |
55 | edits: (TextEdit | SnippetTextEdit)[]; | 55 | edits: (TextEdit | SnippetTextEdit)[]; |
56 | } | 56 | } |
57 | ``` | 57 | ``` |
58 | 58 | ||
@@ -145,9 +145,9 @@ mod foo; | |||
145 | ### Unresolved Question | 145 | ### Unresolved Question |
146 | 146 | ||
147 | * An alternative would be to use a more general "gotoSuper" request, which would work for super methods, super classes and super modules. | 147 | * An alternative would be to use a more general "gotoSuper" request, which would work for super methods, super classes and super modules. |
148 | This is the approach IntelliJ Rust is takeing. | 148 | This is the approach IntelliJ Rust is taking. |
149 | However, experience shows that super module (which generally has a feeling of navigation between files) should be separate. | 149 | However, experience shows that super module (which generally has a feeling of navigation between files) should be separate. |
150 | If you want super module, but the cursor happens to be inside an overriden function, the behavior with single "gotoSuper" request is surprising. | 150 | If you want super module, but the cursor happens to be inside an overridden function, the behavior with single "gotoSuper" request is surprising. |
151 | 151 | ||
152 | ## Join Lines | 152 | ## Join Lines |
153 | 153 | ||
@@ -193,7 +193,7 @@ fn main() { | |||
193 | ### Unresolved Question | 193 | ### Unresolved Question |
194 | 194 | ||
195 | * What is the position of the cursor after `joinLines`? | 195 | * What is the position of the cursor after `joinLines`? |
196 | Currently this is left to editor's discretion, but it might be useful to specify on the server via snippets. | 196 | Currently, this is left to editor's discretion, but it might be useful to specify on the server via snippets. |
197 | However, it then becomes unclear how it works with multi cursor. | 197 | However, it then becomes unclear how it works with multi cursor. |
198 | 198 | ||
199 | ## On Enter | 199 | ## On Enter |
@@ -330,7 +330,7 @@ Moreover, it would be cool if editors didn't need to implement even basic langua | |||
330 | 330 | ||
331 | ### Unresolved Question | 331 | ### Unresolved Question |
332 | 332 | ||
333 | * Should we return a a nested brace structure, to allow paredit-like actions of jump *out* of the current brace pair? | 333 | * Should we return a nested brace structure, to allow paredit-like actions of jump *out* of the current brace pair? |
334 | This is how `SelectionRange` request works. | 334 | This is how `SelectionRange` request works. |
335 | * Alternatively, should we perhaps flag certain `SelectionRange`s as being brace pairs? | 335 | * Alternatively, should we perhaps flag certain `SelectionRange`s as being brace pairs? |
336 | 336 | ||
@@ -419,23 +419,37 @@ Returns internal status message, mostly for debugging purposes. | |||
419 | 419 | ||
420 | Reloads project information (that is, re-executes `cargo metadata`). | 420 | Reloads project information (that is, re-executes `cargo metadata`). |
421 | 421 | ||
422 | ## Status Notification | 422 | ## Server Status |
423 | 423 | ||
424 | **Experimental Client Capability:** `{ "statusNotification": boolean }` | 424 | **Experimental Client Capability:** `{ "serverStatus": boolean }` |
425 | 425 | ||
426 | **Method:** `rust-analyzer/status` | 426 | **Method:** `experimental/serverStatus` |
427 | 427 | ||
428 | **Notification:** | 428 | **Notification:** |
429 | 429 | ||
430 | ```typescript | 430 | ```typescript |
431 | interface StatusParams { | 431 | interface ServerStatusParams { |
432 | status: "loading" | "readyPartial" | "ready" | "invalid" | "needsReload", | 432 | /// `ok` means that the server is completely functional. |
433 | /// | ||
434 | /// `warning` means that the server is partially functional. | ||
435 | /// It can server requests, but some results might be wrong due to, | ||
436 | /// for example, some missing dependencies. | ||
437 | /// | ||
438 | /// `error` means that the server is not functional. For example, | ||
439 | /// there's a fatal build configuration problem. | ||
440 | health: "ok" | "warning" | "error", | ||
441 | /// Is there any pending background work which might change the status? | ||
442 | /// For example, are dependencies being downloaded? | ||
443 | quiescent: bool, | ||
444 | /// Explanatory message to show on hover. | ||
445 | message?: string, | ||
433 | } | 446 | } |
434 | ``` | 447 | ``` |
435 | 448 | ||
436 | This notification is sent from server to client. | 449 | This notification is sent from server to client. |
437 | The client can use it to display persistent status to the user (in modline). | 450 | The client can use it to display *persistent* status to the user (in modline). |
438 | For `needsReload` state, the client can provide a context-menu action to run `rust-analyzer/reloadWorkspace` request. | 451 | It is similar to the `showMessage`, but is intended for stares rather than point-in-time events. |
452 | |||
439 | 453 | ||
440 | ## Syntax Tree | 454 | ## Syntax Tree |
441 | 455 | ||
@@ -497,7 +511,7 @@ Expands macro call at a given position. | |||
497 | This request is sent from client to server to render "inlay hints" -- virtual text inserted into editor to show things like inferred types. | 511 | This request is sent from client to server to render "inlay hints" -- virtual text inserted into editor to show things like inferred types. |
498 | Generally, the client should re-query inlay hints after every modification. | 512 | Generally, the client should re-query inlay hints after every modification. |
499 | 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. | 513 | 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. |
500 | Upstream issue: https://github.com/microsoft/language-server-protocol/issues/956 | 514 | Upstream issues: https://github.com/microsoft/language-server-protocol/issues/956 , https://github.com/rust-analyzer/rust-analyzer/issues/2797 |
501 | 515 | ||
502 | **Request:** | 516 | **Request:** |
503 | 517 | ||