Use includes instead of indexOf (#167608)

Tests microsoft/vscode-pull-request-github#4257
This commit is contained in:
Raymond Zhao 2022-11-29 11:24:18 -08:00 committed by GitHub
parent 7b20bd008e
commit 096f4de76e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -468,13 +468,13 @@ export function isValidLocationForEmmetAbbreviation(document: vscode.TextDocumen
&& propertyNode.separator && propertyNode.separator
&& offset >= propertyNode.separatorToken.end && offset >= propertyNode.separatorToken.end
&& offset <= propertyNode.terminatorToken.start && offset <= propertyNode.terminatorToken.start
&& abbreviation.indexOf(':') === -1) { && !abbreviation.includes(':')) {
return hexColorRegex.test(abbreviation) || abbreviation === '!'; return hexColorRegex.test(abbreviation) || abbreviation === '!';
} }
if (!propertyNode.terminatorToken if (!propertyNode.terminatorToken
&& propertyNode.separator && propertyNode.separator
&& offset >= propertyNode.separatorToken.end && offset >= propertyNode.separatorToken.end
&& abbreviation.indexOf(':') === -1) { && !abbreviation.includes(':')) {
return hexColorRegex.test(abbreviation) || abbreviation === '!'; return hexColorRegex.test(abbreviation) || abbreviation === '!';
} }
if (hexColorRegex.test(abbreviation) || abbreviation === '!') { if (hexColorRegex.test(abbreviation) || abbreviation === '!') {