Skip to content

Commit ce27104

Browse files
authored
update snippet escaping explainer (microsoft#201274)
1 parent a8edb8f commit ce27104

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/vs/editor/contrib/snippet/browser/snippet.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ ${1/^_(.*)/$1/}
103103
Grammar
104104
--
105105

106-
Below is the EBNF for snippets. With `\` (backslash) you can escape `$`, `}` and `\`, within choice elements the backslash also escapes comma and pipe characters.
106+
Below is the EBNF for snippets.
107107

108108
```
109109
any ::= tabstop | placeholder | choice | variable | text
@@ -127,3 +127,5 @@ var ::= [_a-zA-Z] [_a-zA-Z0-9]*
127127
int ::= [0-9]+
128128
text ::= .*
129129
```
130+
131+
Escaping is done with with the `\` (backslash) character. The rule of thumb is that you can escape characters that otherwise would have a syntactic meaning, e.g within text you can escape `$`, `}` and `\`, within choice elements you can escape `|`, `,` and `\`, and within transform elements you can escape `/` and `\`. Also note that in JSON you need to escape `\` as `\\`.

0 commit comments

Comments
 (0)