提交 f8420b48 编写于 作者: M Mathieu Déziel 提交者: Ramya Rao

Fixed emmet validation when open angle bracket is followed by space (#55762)

* Fixed emmet validation when open angle bracket is followed by space

* Fixed space check to support every kind of whitespace

* Added test
上级 e0b36a98
......@@ -498,6 +498,12 @@ export function isValidLocationForEmmetAbbreviation(document: vscode.TextDocumen
i--;
continue;
}
// Fix for https://github.com/Microsoft/vscode/issues/55411
// A space is not a valid character right after < in a tag name.
if (/\s/.test(char) && textToBackTrack[i] === startAngle) {
i--;
continue;
}
if (char !== startAngle && char !== endAngle) {
continue;
}
......
......@@ -466,6 +466,16 @@ suite('Tests for jsx, xml and xsl', () => {
});
});
test('Expand abbreviation with condition containing less than sign for jsx', () => {
return withRandomFileEditor('if (foo < 10) { span.bar', 'javascriptreact', (editor, doc) => {
editor.selection = new Selection(0, 27, 0, 27);
return expandEmmetAbbreviation({ language: 'javascriptreact' }).then(() => {
assert.equal(editor.document.getText(), 'if (foo < 10) { <span className="bar"></span>');
return Promise.resolve();
});
});
});
test('No expanding text inside open tag in completion list (jsx)', () => {
return testNoCompletion('jsx', htmlContents, new Selection(2, 4, 2, 4));
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册