Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SnippetString

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.

Hierarchy

  • SnippetString

Index

Constructors(1)

Properties(1)

Methods(5)

Constructors(1)

constructor

Properties(1)

value

value: string

The snippet string.

Methods(5)

appendText

  • Builder-function that appends the given string to the value of this snippet string.

    Parameters

    • string: string

      A value to append 'as given'. The string will be escaped.

    Returns SnippetString

    This snippet string.

appendTabstop

  • Builder-function that appends a tabstop ($1, $2 etc) to the value of this snippet string.

    Parameters

    • Optional number: number

      The number of this tabstop, defaults to an auto-increment value starting at 1.

    Returns SnippetString

    This snippet string.

appendPlaceholder

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

    Parameters

    • value: string | ((snippet: SnippetString) => any)

      The value of this placeholder - either a string or a function with which a nested snippet can be created.

    • Optional number: number

      The number of this tabstop, defaults to an auto-increment value starting at 1.

    Returns SnippetString

    This snippet string.

appendChoice

  • appendChoice(values: readonly string[], number?: number): SnippetString
  • Builder-function that appends a choice (${1|a,b,c|}) to the value of this snippet string.

    Parameters

    • values: readonly string[]

      The values for choices - the array of strings

    • Optional number: number

      The number of this tabstop, defaults to an auto-increment value starting at 1.

    Returns SnippetString

    This snippet string.

appendVariable

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

    Parameters

    • name: string

      The name of the variable - excluding the $.

    • defaultValue: string | ((snippet: SnippetString) => any)

      The default value which is used when the variable name cannot be resolved - either a string or a function with which a nested snippet can be created.

    Returns SnippetString

    This snippet string.

Generated by TypeDoc. Maintained by 紫升

Links: 搜外友链, 69中文网