Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion _data/linkableTypes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -899,4 +899,6 @@
- type: 'InlineCompletionItem'
link: '#inlineCompletionItem'
- type: 'StringValue'
link: '#stringValue'
link: '#stringValue'
- type: 'SnippetTextEdit'
link: '#snippetTextEdit'
9 changes: 7 additions & 2 deletions _specifications/lsp/3.18/types/textDocumentEdit.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#### <a href="#textDocumentEdit" name="textDocumentEdit" class="anchor"> TextDocumentEdit </a>

> New in version 3.16: support for `AnnotatedTextEdit`. The support is guarded by the client capability `workspace.workspaceEdit.changeAnnotationSupport`. If a client doesn't signal the capability, servers shouldn't send `AnnotatedTextEdit` literals back to the client.
* New in version 3.16: support for `AnnotatedTextEdit`. The support is guarded by the client capability `workspace.workspaceEdit.changeAnnotationSupport`. If a client doesn't signal the capability, servers shouldn't send `AnnotatedTextEdit` literals back to the client.

* New in version 3.18: support for `SnippetTextEdit`. The support is guarded by the client capability `workspace.workspaceEdit.snippetEditSupport`. If a client doesn't signal the capability, servers shouldn't send `SnippetTextEdit` snippets back to the client.

Describes textual changes on a single text document. The text document is referred to as an `OptionalVersionedTextDocumentIdentifier` to allow clients to check the text document version before an edit is applied. A `TextDocumentEdit` describes all changes on a version Si and after they are applied move the document to version Si+1. So, the creator of a `TextDocumentEdit` doesn't need to sort the array of edits or do any kind of ordering. However, the edits must be non overlapping.

Expand All @@ -16,7 +18,10 @@ export interface TextDocumentEdit {
*
* @since 3.16.0 - support for AnnotatedTextEdit. This is guarded by the
* client capability `workspace.workspaceEdit.changeAnnotationSupport`
*
* @since 3.18.0 - support for SnippetTextEdit. This is guarded by the
* client capability `workspace.workspaceEdit.snippetEditSupport`
*/
edits: (TextEdit | AnnotatedTextEdit)[];
edits: (TextEdit | AnnotatedTextEdit | SnippetTextEdit)[];
}
```
38 changes: 36 additions & 2 deletions _specifications/lsp/3.18/types/textEdit.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#### <a href="#textEdit" name="textEdit" class="anchor"> TextEdit & AnnotatedTextEdit </a>
#### <a href="#textEdit" name="textEdit" class="anchor"> TextEdit, AnnotatedTextEdit & SnippetTextEdit </a>

- New in version 3.16: Support for `AnnotatedTextEdit`.
- New in version 3.18: Support for `SnippetTextEdit`.

> New in version 3.16: Support for `AnnotatedTextEdit`.

A textual edit applicable to a text document.

Expand Down Expand Up @@ -79,3 +81,35 @@ export interface AnnotatedTextEdit extends TextEdit {
annotationId: ChangeAnnotationIdentifier;
}
```

Since 3.18.0, there is also the concept of a snippet text edit, which supports inserting a snippet instead of plain text.
Comment thread
MariaSolOs marked this conversation as resolved.

Some important remarks:
- For each file, only one snippet can specify a cursor position. In case there are multiple snippets defining a cursor position for a given URI, it is up to the client to decide the end position of the cursor.
- In case the snippet text edit corresponds to a file that is not currently open in the editor, the client should downgrade the snippet to a non-interactive normal text edit and apply it to the file. This ensures that a workspace edit doesn't open arbitrary files.

<div class="anchorHolder"><a href="#snippetTextEdit" name="snippetTextEdit" class="linkableAnchor"></a></div>

```typescript
/**
* An interactive text edit.
*
* @since 3.18.0
*/
export interface SnippetTextEdit {
/**
* The range of the text document to be manipulated.
*/
range: Range;

/**
* The snippet to be inserted.
*/
snippet: StringValue;
Comment thread
MariaSolOs marked this conversation as resolved.

/**
* The actual identifier of the snippet edit.
*/
annotationId?: ChangeAnnotationIdentifier;
}
```
8 changes: 8 additions & 0 deletions _specifications/lsp/3.18/types/workspaceEdit.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@ export interface WorkspaceEditClientCapabilities {
* @proposed
*/
metadataSupport?: boolean;

/**
* Whether the client supports snippets as text edits.
*
* @since 3.18.0
* @proposed
*/
snippetEditSupport?: boolean;
}
```

Expand Down