SnippetString

open class SnippetString(source)

A snippet string 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}. Also see the full snippet syntax.

Online Documentation

Constructors

Link copied to clipboard
constructor(value: String = definedExternally)

Create a new snippet string.

Properties

Link copied to clipboard

The snippet string.

Functions

Link copied to clipboard
fun appendChoice(values: ReadonlyArray<JsString>, number: Int = definedExternally): SnippetString

Builder-function that appends a choice (${1|a,b,c|}) to the {@linkcode SnippetString.value value} of this snippet string.

Link copied to clipboard
fun appendPlaceholder(value: JsAny, number: Int = definedExternally): SnippetString

Builder-function that appends a placeholder (${1:value}) to the {@linkcode SnippetString.value value} of this snippet string.

Link copied to clipboard
fun appendTabstop(number: Int = definedExternally): SnippetString

Builder-function that appends a tabstop ($1, $2 etc) to the {@linkcode SnippetString.value value} of this snippet string.

Link copied to clipboard

Builder-function that appends the given string to the {@linkcode SnippetString.value value} of this snippet string.

Link copied to clipboard
fun appendVariable(name: String, defaultValue: JsAny): SnippetString

Builder-function that appends a variable (${VAR}) to the {@linkcode SnippetString.value value} of this snippet string.