Add ! as stylesheet trigger character for Emmet, fixes #117020

This commit is contained in:
Raymond Zhao 2021-02-19 18:39:07 +00:00 committed by GitHub
parent 68a4faad81
commit d29d7e023b
2 changed files with 13 additions and 6 deletions

View file

@ -37,6 +37,13 @@ suite('Tests for completion in CSS embedded in HTML', () => {
{ label: 'widows: ;', documentation: `widows: ;` }
]);
});
// https://github.com/microsoft/vscode/issues/117020
test('#117020, ! at end of abbreviation should have completion', async () => {
await testCssCompletionProvider(`.foo { bdbn!| }`, [
{ label: 'border-bottom: none !important;', documentation: `border-bottom: none !important;` }
]);
});
});
interface TestCompletionItem {

View file

@ -62,18 +62,18 @@ export const LANGUAGE_MODES: { [id: string]: string[] } = {
'haml': ['!', '.', '}', ':', '*', '$', ']', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
'xml': ['.', '}', '*', '$', ']', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
'xsl': ['!', '.', '}', '*', '$', ']', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
'css': [':', '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
'scss': [':', '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
'sass': [':', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
'less': [':', '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
'stylus': [':', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
'css': [':', '!', '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
'scss': [':', '!', '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
'sass': [':', '!', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
'less': [':', '!', '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
'stylus': [':', '!', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
'javascriptreact': ['!', '.', '}', '*', '$', ']', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
'typescriptreact': ['!', '.', '}', '*', '$', ']', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
};
export function isStyleSheet(syntax: string): boolean {
let stylesheetSyntaxes = ['css', 'scss', 'sass', 'less', 'stylus'];
return (stylesheetSyntaxes.indexOf(syntax) > -1);
return stylesheetSyntaxes.includes(syntax);
}
export function validate(allowStylesheet: boolean = true): boolean {