- Description:
This key defines configuration options for key-value list parser configurations.
The value is an object that can contain
models,format, andstyleproperties. These options control how multiple key-value pairs are parsed and validated.- Appears in:
└── Snippet └── params └── * └── Key Value List Parser Configuration └── options- Type:
Object- Properties:
This key defines formatting options for parsing snippet parameters.
The value is an object that can contain various options controlling how snippet parameters are parsed, including boundaries, delimiters, allowed value types, and string formatting options.
Show examplesHide examples
A common option to configure for the argument parser is the
string_boundary:Copied to clipboard_snippets: video: snippet: <<video [[video_arg]]>> params: video_arg: parser: argument options: model: editor_key: video_id format: string_boundary: - '"' - '`'{ "_snippets": { "video": { "snippet": "<<video [[video_arg]]>>", "params": { "video_arg": { "parser": "argument", "options": { "model": { "editor_key": "video_id" }, "format": { "string_boundary": [ "\"", "`" ] } } } } } } }This would make our snippet match
<<video "CZcNgDN81Sw">>or<<video `CZcNgDN81Sw`>>but not<<video 'CZcNgDN81Sw'>>or<<video CZcNgDN81Sw>>.Another common requirement is specifying
forbidden_tokens, especially when defining an argument with no string boundary.Copied to clipboard_snippets: video: snippet: <<video [[video_arg]]>> params: video_arg: parser: argument options: model: editor_key: video_id format: forbidden_tokens: - '>' string_boundary: - ''{ "_snippets": { "video": { "snippet": "<<video [[video_arg]]>>", "params": { "video_arg": { "parser": "argument", "options": { "model": { "editor_key": "video_id" }, "format": { "forbidden_tokens": [ ">" ], "string_boundary": [ "" ] } } } } } } }This key defines the models for each key in key-value list parser configurations.
The value is an object where each property key is a key name and each property value is a model configuration object. These models define how each key-value pair is parsed and validated.
Show examplesHide examples
In this example, we have configured models for key-value pairs in a key-value list parser.
Copied to clipboard_snippets: example: snippet: <<example key1=value1 key2=value2>> params: params: parser: key_values options: models: key1: editor_key: value1_input key2: editor_key: value2_input{ "_snippets": { "example": { "snippet": "<<example key1=value1 key2=value2>>", "params": { "params": { "parser": "key_values", "options": { "models": { "key1": { "editor_key": "value1_input" }, "key2": { "editor_key": "value2_input" } } } } } } } }This key defines styling options for snippet output formatting.
The value is an object that can contain
output,inline, andblockproperties. These options control how snippet content is parsed and formatted to produce cleaner source code.Show examplesHide examples
In this example, we have configured snippet style with inline and block formatting options.
Copied to clipboard_snippets: highlight: snippet: <<highlight>> [[content]] <</highlight>> params: content: parser: content options: style: inline: leading: ' ' trailing: ' ' block: leading: \n trailing: \n indent: ' '{ "_snippets": { "highlight": { "snippet": "<<highlight>> [[content]] <</highlight>>", "params": { "content": { "parser": "content", "options": { "style": { "inline": { "leading": " ", "trailing": " " }, "block": { "leading": "\\n", "trailing": "\\n", "indent": " " } } } } } } } }- Examples:
In this example, we have configured key-value list parser options with models.
Copied to clipboard_snippets: example: snippet: <<example key1=value1 key2=value2>> params: params: parser: key_values options: models: key1: editor_key: value1_input key2: editor_key: value2_input{ "_snippets": { "example": { "snippet": "<<example key1=value1 key2=value2>>", "params": { "params": { "parser": "key_values", "options": { "models": { "key1": { "editor_key": "value1_input" }, "key2": { "editor_key": "value2_input" } } } } } } } }