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.

Hierarchy

  • SnippetString

Index

Constructors

constructor

Properties

value

value: string

The snippet string.

Methods

appendPlaceholder

  • appendPlaceholder(value: string | function, number?: number): SnippetString
  • Builder-function that appends a placeholder (${1:value}) to the value of this snippet string.

    Parameters

    • value: string | function

      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-incremet value starting at 1.

    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-incremet value starting at 1.

    Returns SnippetString

    This snippet string.

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.

appendVariable

  • appendVariable(name: string, defaultValue: string | function): SnippetString
  • 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 | function

      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.