Module: util/snippet
Functions
findMatchingSnippetDefinitionStrict
▸ findMatchingSnippetDefinitionStrict(targets
, definitions
): SnippetDefinition
Based on the context determined by {@link targets} (eg the file's language id and containing scope), finds the first snippet definition that matches the given context. Throws an error if different snippet definitions match for different targets or if matching snippet definition could not be found
Parameters
Name | Type | Description |
---|---|---|
targets | Target [] | The target that defines the context to use for finding the right snippet definition |
definitions | SnippetDefinition [] | The list of snippet definitions to search |
Returns
The snippet definition that matches the given context
Defined in
util/snippet.ts:86
transformSnippetVariables
▸ transformSnippetVariables(parsedSnippet
, placeholderName?
, substitutions?
): void
Replaces the snippet variable with name placeholderName
with
TM_SELECTED_TEXT
Also replaces any unknown variables with placeholders. We do this so it's easier to leave one of the placeholders blank. We may make it so that you can disable this with a setting in the future
Parameters
Name | Type | Description |
---|---|---|
parsedSnippet | TextmateSnippet | The parsed textmate snippet to operate on |
placeholderName? | null | string | The variable name to replace with TM_SELECTED_TEXT |
substitutions? | Record <string , string > | A map from variable names to text values that will be substituted and the given variable will no longer be a placeholder in the final snippet |
Returns
void
Defined in
util/snippet.ts:24