aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/dev/lsp-extensions.md55
-rw-r--r--docs/dev/syntax.md4
2 files changed, 30 insertions, 29 deletions
diff --git a/docs/dev/lsp-extensions.md b/docs/dev/lsp-extensions.md
index 780f5cb91..8c01db07c 100644
--- a/docs/dev/lsp-extensions.md
+++ b/docs/dev/lsp-extensions.md
@@ -1,8 +1,8 @@
1<!--- 1<!---
2lsp_ext.rs hash: 286f8bbac885531a 2lsp_ext.rs hash: 203fdf79b21b5987
3 3
4If you need to change the above hash to make the test pass, please check if you 4If you need to change the above hash to make the test pass, please check if you
5need to adjust this doc as well and ping this issue: 5need to adjust this doc as well and ping this issue:
6 6
7 https://github.com/rust-analyzer/rust-analyzer/issues/4604 7 https://github.com/rust-analyzer/rust-analyzer/issues/4604
8 8
@@ -45,7 +45,7 @@ interface SnippetTextEdit extends TextEdit {
45 45
46```typescript 46```typescript
47export interface TextDocumentEdit { 47export interface TextDocumentEdit {
48 textDocument: VersionedTextDocumentIdentifier; 48 textDocument: OptionalVersionedTextDocumentIdentifier;
49 edits: (TextEdit | SnippetTextEdit)[]; 49 edits: (TextEdit | SnippetTextEdit)[];
50} 50}
51``` 51```
@@ -109,30 +109,6 @@ Invoking code action at this position will yield two code actions for importing
109* Is a fixed two-level structure enough? 109* Is a fixed two-level structure enough?
110* Should we devise a general way to encode custom interaction protocols for GUI refactorings? 110* Should we devise a general way to encode custom interaction protocols for GUI refactorings?
111 111
112## Lazy assists with `ResolveCodeAction`
113
114**Issue:** https://github.com/microsoft/language-server-protocol/issues/787
115
116**Client Capability** `{ "resolveCodeAction": boolean }`
117
118If this capability is set, the assists will be computed lazily. Thus `CodeAction` returned from the server will only contain `id` but not `edit` or `command` fields. The only exclusion from the rule is the diagnostic edits.
119
120After the client got the id, it should then call `experimental/resolveCodeAction` command on the server and provide the following payload:
121
122```typescript
123interface ResolveCodeActionParams {
124 id: string;
125 codeActionParams: lc.CodeActionParams;
126}
127```
128
129As a result of the command call the client will get the respective workspace edit (`lc.WorkspaceEdit`).
130
131### Unresolved Questions
132
133* Apply smarter filtering for ids?
134* Upon `resolveCodeAction` command only call the assits which should be resolved and not all of them?
135
136## Parent Module 112## Parent Module
137 113
138**Issue:** https://github.com/microsoft/language-server-protocol/issues/1002 114**Issue:** https://github.com/microsoft/language-server-protocol/issues/1002
@@ -561,3 +537,28 @@ Such actions on the client side are appended to a hover bottom as command links:
561 +-----------------------------+ 537 +-----------------------------+
562 ... 538 ...
563``` 539```
540
541## Open Cargo.toml
542
543**Issue:** https://github.com/rust-analyzer/rust-analyzer/issues/6462
544
545This request is sent from client to server to open the current project's Cargo.toml
546
547**Method:** `experimental/openCargoToml`
548
549**Request:** `OpenCargoTomlParams`
550
551**Response:** `Location | null`
552
553
554### Example
555
556```rust
557// Cargo.toml
558[package]
559// src/main.rs
560
561/* cursor here*/
562```
563
564`experimental/openCargoToml` returns a single `Link` to the start of the `[package]` keyword.
diff --git a/docs/dev/syntax.md b/docs/dev/syntax.md
index 2eb08b7ca..1edafab68 100644
--- a/docs/dev/syntax.md
+++ b/docs/dev/syntax.md
@@ -195,7 +195,7 @@ Modeling this with immutable trees is possible, but annoying.
195A function green tree is not super-convenient to use. 195A function green tree is not super-convenient to use.
196The biggest problem is accessing parents (there are no parent pointers!). 196The biggest problem is accessing parents (there are no parent pointers!).
197But there are also "identify" issues. 197But there are also "identify" issues.
198Let's say you want to write a code which builds a list of expressions in a file: `fn collect_exrepssions(file: GreenNode) -> HashSet<GreenNode>`. 198Let's say you want to write a code which builds a list of expressions in a file: `fn collect_expressions(file: GreenNode) -> HashSet<GreenNode>`.
199For the input like 199For the input like
200 200
201```rust 201```rust
@@ -236,7 +236,7 @@ impl SyntaxNode {
236 self.parent.clone() 236 self.parent.clone()
237 } 237 }
238 fn children(&self) -> impl Iterator<Item = SyntaxNode> { 238 fn children(&self) -> impl Iterator<Item = SyntaxNode> {
239 let mut offset = self.offset 239 let mut offset = self.offset;
240 self.green.children().map(|green_child| { 240 self.green.children().map(|green_child| {
241 let child_offset = offset; 241 let child_offset = offset;
242 offset += green_child.text_len; 242 offset += green_child.text_len;