aboutsummaryrefslogtreecommitdiff
path: root/docs/dev/lsp-extensions.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/dev/lsp-extensions.md')
-rw-r--r--docs/dev/lsp-extensions.md34
1 files changed, 34 insertions, 0 deletions
diff --git a/docs/dev/lsp-extensions.md b/docs/dev/lsp-extensions.md
new file mode 100644
index 000000000..d2ec6c021
--- /dev/null
+++ b/docs/dev/lsp-extensions.md
@@ -0,0 +1,34 @@
1# LSP Extensions
2
3This document describes LSP extensions used by rust-analyzer.
4It's a best effort document, when in doubt, consult the source (and send a PR with clarification ;-) ).
5We aim to upstream all non Rust-specific extensions to the protocol, but this is not a top priority.
6All capabilities are enabled via `experimental` field of `ClientCapabilities`.
7
8## `SnippetTextEdit`
9
10**Capability**
11
12```typescript
13{
14 "snippetTextEdit": boolean
15}
16```
17
18If this capability is set, `WorkspaceEdit`s returned from `codeAction` requests might contain `SnippetTextEdit`s instead of usual `TextEdit`s:
19
20```typescript
21interface SnippetTextEdit extends TextEdit {
22 insertTextFormat?: InsertTextFormat;
23}
24```
25
26```typescript
27export interface TextDocumentEdit {
28 textDocument: VersionedTextDocumentIdentifier;
29 edits: (TextEdit | SnippetTextEdit)[];
30}
31```
32
33When applying such code action, the editor should insert snippet, with tab stops and placeholder.
34At the moment, rust-analyzer guarantees that only a single edit will have `InsertTextFormat.Snippet`.