- Description:
This key defines configuration options for argument parser configurations.
The value is an object that can contain
modelandformatproperties. These options control how a single argument value is parsed and validated.- Appears in:
└── Snippet └── params └── * └── Argument Parser Configuration └── options- Type:
ObjectRequired- 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": [ "" ] } } } } } } }- Examples:
In this example, we have configured argument parser options with a model and format.
Copied to clipboard_snippets: example: snippet: <<example [[param]]>> params: param: parser: argument options: model: editor_key: example_id format: string_boundary: - '"'{ "_snippets": { "example": { "snippet": "<<example [[param]]>>", "params": { "param": { "parser": "argument", "options": { "model": { "editor_key": "example_id" }, "format": { "string_boundary": [ "\"" ] } } } } } } }