Add string value definition (#1893)

This commit is contained in:
Maria José Solano 2024-02-02 01:25:13 -08:00 committed by GitHub
parent b9c4429703
commit 0a0ccb4bfb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 36 additions and 2 deletions

1
.gitignore vendored
View file

@ -2,3 +2,4 @@ npm-debug.log
_site/
.bundle/
vendor/
.jekyll-metadata

View file

@ -897,4 +897,6 @@
- type: 'InlineCompletionList'
link: '#inlineCompletionList'
- type: 'InlineCompletionItem'
link: '#inlineCompletionItem'
link: '#inlineCompletionItem'
- type: 'StringValue'
link: '#stringValue'

View file

@ -56,6 +56,8 @@
anchor: textDocumentPositionParams
- title: Document Filter
anchor: documentFilter
- title: String Value
anchor: stringValue
- title: Text Edit
anchor: textEdit
- title: Text Edit Array

View file

@ -203,7 +203,7 @@ export interface InlineCompletionItem {
* The text to replace the range with. Must be set.
* Is used both for the preview and the accept operation.
*/
insertText: string;
insertText: string | StringValue;
/**
* A text that is used to decide if this inline completion should be

View file

@ -451,6 +451,7 @@ There are quite some JSON structures that are shared between different requests
{% include_relative types/textDocumentPositionParams.md %}
{% include_relative types/documentFilter.md %}
{% include_relative types/stringValue.md %}
{% include_relative types/textEdit.md %}
{% include_relative types/textEditArray.md %}
{% include_relative types/textDocumentEdit.md %}

View file

@ -0,0 +1,28 @@
#### <a href="#stringValue" name="stringValue" class="anchor"> String Value </a>
Template strings for inserting text and controlling the editor cursor upon insertion.
```typescript
/**
* A string value used as a snippet is a template which allows to insert text
* and to control the editor cursor when insertion happens.
*
* A snippet can define tab stops and placeholders with `$1`, `$2`
* and `${3:foo}`. `$0` defines the final tab stop, it defaults to
* the end of the snippet. Variables are defined with `$name` and
* `${name:default value}`.
*
* @since 3.18.0
*/
export interface StringValue {
/**
* The kind of string value.
*/
kind: 'snippet';
/**
* The snippet string.
*/
value: string;
}
```