Replace some common index based for loops with for-of loops

Replaces many loops of the form:

```js
for (let i = 0; i < elements.length; ++i) {
    const i = elements[i];
   ...
}
```

with:

```js
for (const element of elements) {
    ...
}
```

Mix of a horrible regex based find/replace and manual touch ups
This commit is contained in:
Matt Bierner
2019-01-03 19:11:18 -08:00
parent dc261e0436
commit b4964bcf35
74 changed files with 139 additions and 227 deletions

View File

@@ -139,9 +139,9 @@ function pathToSuggestion(p: string, valueBeforeCursor: string, fullValue: strin
}
function resolveWorkspaceRoot(activeDoc: TextDocument, workspaceFolders: WorkspaceFolder[]): string | undefined {
for (let i = 0; i < workspaceFolders.length; i++) {
if (startsWith(activeDoc.uri, workspaceFolders[i].uri)) {
return path.resolve(URI.parse(workspaceFolders[i].uri).fsPath);
for (const folder of workspaceFolders) {
if (startsWith(activeDoc.uri, folder.uri)) {
return path.resolve(URI.parse(folder.uri).fsPath);
}
}
return undefined;