Skip to content

Commit

Permalink
remove rule '${' int '|' text (',' text)* '|' transform '}' #52931
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Jun 28, 2018
1 parent 85f8f14 commit ab21dfa
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 17 deletions.
3 changes: 0 additions & 3 deletions src/vs/editor/contrib/snippet/snippet.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ tabstop ::= '$' int
| '${' int transform '}'
placeholder ::= '${' int ':' any '}'
choice ::= '${' int '|' text (',' text)* '|}'
| '${' int '|' text (',' text)* '|' transform '}'
variable ::= '$' var | '${' var }'
| '${' var ':' any '}'
| '${' var transform '}'
Expand All @@ -102,5 +101,3 @@ var ::= [_a-zA-Z] [_a-zA-Z0-9]*
int ::= [0-9]+
text ::= .*
```

Transformations for placeholders and choices are an extension to the TextMate snippet grammar and only support by Visual Studio Code.
7 changes: 0 additions & 7 deletions src/vs/editor/contrib/snippet/snippetParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -746,13 +746,6 @@ export class SnippetParser {
parent.appendChild(placeholder);
return true;
}
if (this._accept(TokenType.Forwardslash)) {
// ...|/<regex>/<format>/<options>} -> transform
if (this._parseTransform(placeholder)) {
parent.appendChild(placeholder);
return true;
}
}
}
}

Expand Down
7 changes: 0 additions & 7 deletions src/vs/editor/contrib/snippet/test/snippetParser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,6 @@ suite('SnippetParser', () => {
assertTextAndMarker('${1/regex/format/options', '${1/regex/format/options', Text);
});

test('Parser, placeholder with choice and transformation', () => {
assertTextAndMarker('${1|one,two,three|/foo/bar/}', 'one', Placeholder);
assertTextAndMarker('${1|one|/foo/bar/}', 'one', Placeholder);
assertTextAndMarker('${1|one,two,three,|/foo/bar/}', '${1|one,two,three,|/foo/bar/}', Text);
assertTextAndMarker('${1|one,/foo/bar/', '${1|one,/foo/bar/', Text);
});

test('No way to escape forward slash in snippet regex #36715', function () {
assertMarker('${TM_DIRECTORY/src\\//$1/}', Variable);
});
Expand Down

0 comments on commit ab21dfa

Please sign in to comment.