This commit is contained in:
Johannes Rieken
2017-11-20 15:50:12 +01:00
parent d2c775cff1
commit 7839886908
2 changed files with 14 additions and 0 deletions
@@ -861,6 +861,14 @@ export class SnippetParser {
if (this._accept(TokenType.Forwardslash)) {
break;
}
let escaped: string;
if (escaped = this._accept(TokenType.Backslash, true)) {
escaped = this._accept(TokenType.Forwardslash, true) || escaped;
transform.appendChild(new Text(escaped));
continue;
}
if (this._parseFormatString(transform) || this._parseAnything(transform)) {
continue;
}
@@ -244,6 +244,12 @@ suite('SnippetParser', () => {
assertMarker('${TM_DIRECTORY/src\\//$1/}', Variable);
});
test('No way to escape forward slash in snippet format section #37562', function () {
assertMarker('${TM_SELECTED_TEXT/a/\\/$1/g}', Variable);
assertMarker('${TM_SELECTED_TEXT/a/in\\/$1ner/g}', Variable);
assertMarker('${TM_SELECTED_TEXT/a/end\\//g}', Variable);
});
test('Parser, placeholder with choice', () => {
assertTextAndMarker('${1|one,two,three|}', 'one', Placeholder);