diff --git a/packages/ansible-language-server/src/utils/yaml.ts b/packages/ansible-language-server/src/utils/yaml.ts index 2e903bdea..097afae2b 100644 --- a/packages/ansible-language-server/src/utils/yaml.ts +++ b/packages/ansible-language-server/src/utils/yaml.ts @@ -50,7 +50,7 @@ export class AncestryBuilder { ): AncestryBuilder { this._index--; if (isPair(this.get())) { - if (!type || !(type === Pair.prototype.constructor)) { + if (!type || type !== Pair.prototype.constructor) { this._index--; } } diff --git a/src/features/lightspeed/utils/data.ts b/src/features/lightspeed/utils/data.ts index 08eb724e4..5dc70b024 100644 --- a/src/features/lightspeed/utils/data.ts +++ b/src/features/lightspeed/utils/data.ts @@ -301,7 +301,7 @@ const matchLine = ( indentIndex: number, validSuggestionTriggerIndents: number[], ) => { - const matched = documentLines[indentIndex].match(/^\s*-\s*/); + const matched = /^\s*-\s*/.exec(documentLines[indentIndex]); if (matched) { const indentLength = Math.max(matched[0].length - 2, 0); if (validSuggestionTriggerIndents[indentIndex] === -1) { @@ -320,12 +320,12 @@ function shouldTriggerMultiTaskSuggestionForTaskFile( let firstMatchKeywordIndent = -1; const validSuggestionTriggerIndents: number[] = []; let matchKeywordIndex = -1; - for (let lineIndex = 0; lineIndex < documentLines.length; lineIndex++) { + for (const _ of documentLines) { validSuggestionTriggerIndents.push(-1); } for (let lineIndex = documentLines.length - 1; lineIndex >= 0; lineIndex--) { if (matchKeyword(tasksFileKeywords, documentLines[lineIndex])) { - const match = documentLines[lineIndex].match(/^\s*/); + const match = /^\s*/.exec(documentLines[lineIndex]); if (firstMatchKeywordIndent === -1) { firstMatchKeywordIndent = match ? match[0].length : -1; } diff --git a/src/features/lightspeed/utils/scanner.ts b/src/features/lightspeed/utils/scanner.ts index cf34188dc..52f3196dc 100644 --- a/src/features/lightspeed/utils/scanner.ts +++ b/src/features/lightspeed/utils/scanner.ts @@ -102,8 +102,8 @@ export class CollectionFinder { return []; }); const r: AnsibleCollection[] = []; - for (let i = 0; i < a.length; i++) { - (await Promise.all(await a[i])).forEach((entry) => { + for (const item of a) { + (await Promise.all(await item)).forEach((entry) => { if (entry instanceof AnsibleCollection) { r.push(entry); }