Skip to content

Commit 459543b

Browse files
committed
1 parent 5497e60 commit 459543b

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

src/vs/workbench/api/common/extHostTypes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ export class SnippetString {
782782
}
783783

784784
appendChoice(values: string[], number: number = this._tabstop++): SnippetString {
785-
const value = SnippetString._escape(values.toString());
785+
const value = values.map(s => s.replace(/\$|}|\\|,/g, '\\$&')).join(',');
786786

787787
this.value += '${';
788788
this.value += number;

src/vs/workbench/test/browser/api/extHostTypes.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,10 @@ suite('ExtHostTypes', function () {
524524
string.appendChoice(['b', 'a', 'r']);
525525
assert.equal(string.value, '${1|b,a,r|}');
526526

527+
string = new types.SnippetString();
528+
string.appendChoice(['b,1', 'a,2', 'r,3']);
529+
assert.equal(string.value, '${1|b\\,1,a\\,2,r\\,3|}');
530+
527531
string = new types.SnippetString();
528532
string.appendChoice(['b', 'a', 'r'], 0);
529533
assert.equal(string.value, '${0|b,a,r|}');

0 commit comments

Comments
 (0)