Use includes instead of indexOf (#167778)

This commit is contained in:
Raymond Zhao 2022-11-30 14:44:10 -08:00 committed by GitHub
parent 2a16bdb467
commit 968026a46d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -289,7 +289,7 @@ export function expandEmmetAbbreviation(args: any): Thenable<boolean | undefined
args['language'] = vscode.window.activeTextEditor.document.languageId;
} else {
const excludedLanguages = vscode.workspace.getConfiguration('emmet')['excludeLanguages'] ? vscode.workspace.getConfiguration('emmet')['excludeLanguages'] : [];
if (excludedLanguages.indexOf(vscode.window.activeTextEditor.document.languageId) > -1) {
if (excludedLanguages.includes(vscode.window.activeTextEditor.document.languageId)) {
return fallbackTab();
}
}
@ -527,7 +527,7 @@ export function isValidLocationForEmmetAbbreviation(document: vscode.TextDocumen
const typeAttribute = (currentHtmlNode.attributes || []).filter(x => x.name.toString() === 'type')[0];
const typeValue = typeAttribute ? typeAttribute.value.toString() : '';
if (allowedMimeTypesInScriptTag.indexOf(typeValue) > -1) {
if (allowedMimeTypesInScriptTag.includes(typeValue)) {
return true;
}

View file

@ -43,7 +43,7 @@ export class DefaultCompletionItemProvider implements vscode.CompletionItemProvi
private provideCompletionItemsInternal(document: vscode.TextDocument, position: vscode.Position, context: vscode.CompletionContext): Thenable<vscode.CompletionList | undefined> | undefined {
const emmetConfig = vscode.workspace.getConfiguration('emmet');
const excludedLanguages = emmetConfig['excludeLanguages'] ? emmetConfig['excludeLanguages'] : [];
if (excludedLanguages.indexOf(document.languageId) > -1) {
if (excludedLanguages.includes(document.languageId)) {
return;
}