提交 d2ce942b 编写于 作者: J Johannes Rieken

fix #28983

上级 51670ce8
......@@ -229,9 +229,7 @@ export function walk(marker: Marker[], visitor: (marker: Marker) => boolean): vo
if (!recurse) {
break;
}
if (marker instanceof Placeholder || marker instanceof Variable) {
stack.unshift(...marker.children);
}
stack.unshift(...marker.children);
}
}
......@@ -366,13 +364,14 @@ export class SnippetParser {
// like `${1:foo}and$1` becomes ${1:foo}and${1:foo}
if (!placeholderDefaultValues.has(thisMarker.index)) {
placeholderDefaultValues.set(thisMarker.index, thisMarker.children);
walk(thisMarker.children, placeholderDefaultValues);
} else if (thisMarker.children.length === 0) {
// copy children from first placeholder definition, no need to
// recurse on them because they have been visited already
thisMarker.children = placeholderDefaultValues.get(thisMarker.index).slice(0);
}
if (thisMarker.children.length > 0) {
walk(thisMarker.children, placeholderDefaultValues);
}
} else if (thisMarker instanceof Variable) {
walk(thisMarker.children, placeholderDefaultValues);
......
......@@ -389,4 +389,8 @@ suite('SnippetParser', () => {
assert.equal(Placeholder.compareByIndex(_10, _2), 1);
});
test('Maximum call stack size exceeded, #28983', function () {
new SnippetParser().parse('${1:${foo:${1}}}');
});
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册