Closed MoritzKn closed 7 years ago
I just tried to create a snippet for the rust format markro. The syntax looks like this:
format!("hello {}", "world!");
So I added this to my snippets:
{ ".source.rust": { "format": { "prefix": "format", "body": "format!(\"${1:{}}\", ${2:value})$0" } }
But if I type this:
format<tab>
it will result in
format!("{}", value)
but only the opening bracket ({) is selected.
{
I assume this is because the placeholder text is parsed by a simple regex like [^}]. If I am not mistaking, this is the responsible code.
[^}]
Oh, nevermind. I just realized I have to escape the closing curly bracket. This worked:
"format": { "prefix": "format", "body": "format!(\"${1:\\{\\}}\", ${2:value})$0" }
I just tried to create a snippet for the rust format markro. The syntax looks like this:
So I added this to my snippets:
But if I type this:
it will result in
but only the opening bracket (
{
) is selected.I assume this is because the placeholder text is parsed by a simple regex like
[^}]
. If I am not mistaking, this is the responsible code.