mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
work around broken snippet files
This commit is contained in:
parent
ae23d37999
commit
613dd2eb19
|
@ -474,7 +474,7 @@ function _fillCodeSnippetFromMarker(snippet: CodeSnippet, marker: Marker[]) {
|
|||
snippet.lines.push(...lines);
|
||||
|
||||
} else if (marker instanceof Placeholder) {
|
||||
|
||||
// TODO - not every variable is a placeholder
|
||||
let placeHolder = placeHolders[marker.name];
|
||||
if (!placeHolder) {
|
||||
placeHolders[marker.name] = placeHolder = {
|
||||
|
@ -495,7 +495,14 @@ function _fillCodeSnippetFromMarker(snippet: CodeSnippet, marker: Marker[]) {
|
|||
endColumn: column + Marker.toString(marker.value).length // TODO multiline placeholders!
|
||||
});
|
||||
|
||||
stack.unshift(...marker.value);
|
||||
if (marker.value.length === 0 && marker.isVariable) {
|
||||
// HACK this is here because we falsy advertise
|
||||
// ${foo} as placeholder in our own snippets
|
||||
stack.unshift(new Text(marker.name));
|
||||
|
||||
} else {
|
||||
stack.unshift(...marker.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ suite('Editor Contrib - Snippets', () => {
|
|||
|
||||
assertInternalAndTextmate(
|
||||
'{{first}}-{{2:}}-{{second}}-{{1:}}',
|
||||
'${first:first}-${2}-${second:second}-${1}',
|
||||
'${first}-${2}-${second}-${1}',
|
||||
snippet => {
|
||||
assert.deepEqual(snippet.lines, ['first--second-']);
|
||||
assert.equal(snippet.placeHolders.length, 4);
|
||||
|
|
Loading…
Reference in a new issue