This commit is contained in:
Raymond Zhao 2021-03-01 14:06:34 -08:00 committed by GitHub
parent 5aeafe2b20
commit 8e37e4722e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 4 deletions

View file

@ -440,10 +440,18 @@ export function isValidLocationForEmmetAbbreviation(document: vscode.TextDocumen
return true;
}
// Get the abbreviation right now
// Fixes https://github.com/microsoft/vscode/issues/74505
// Stylesheet abbreviations starting with @ should bring up suggestions
// even at outer-most level
const abbreviation = document.getText(new vscode.Range(abbreviationRange.start.line, abbreviationRange.start.character, abbreviationRange.end.line, abbreviationRange.end.character));
if (abbreviation.startsWith('@')) {
return true;
}
// Fix for https://github.com/microsoft/vscode/issues/34162
// Other than sass, stylus, we can make use of the terminator tokens to validate position
if (syntax !== 'sass' && syntax !== 'stylus' && currentNode.type === 'property') {
// Fix for upstream issue https://github.com/emmetio/css-parser/issues/3
if (currentNode.parent
&& currentNode.parent.type !== 'rule'
@ -451,7 +459,6 @@ export function isValidLocationForEmmetAbbreviation(document: vscode.TextDocumen
return false;
}
const abbreviation = document.getText(new vscode.Range(abbreviationRange.start.line, abbreviationRange.start.character, abbreviationRange.end.line, abbreviationRange.end.character));
const propertyNode = <Property>currentNode;
if (propertyNode.terminatorToken
&& propertyNode.separator

View file

@ -60,7 +60,7 @@ p {
/* .foo { op.3
dn {
*/
@
bgc
} bg
`;
return withRandomFileEditor(sassContents, '.scss', (_, doc) => {
@ -69,7 +69,7 @@ dn {
new vscode.Range(2, 3, 2, 7), // Line commented selector
new vscode.Range(3, 3, 3, 7), // Block commented selector
new vscode.Range(4, 0, 4, 2), // dn inside block comment
new vscode.Range(6, 1, 6, 2), // @ inside a rule whose opening brace is commented
new vscode.Range(6, 1, 6, 2), // bgc inside a rule whose opening brace is commented
new vscode.Range(7, 2, 7, 4) // bg after ending of badly constructed block
];
rangesNotEmmet.forEach(range => {