Skip to content

Commit

Permalink
fix: loop not awaiting result
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianKohler committed Sep 20, 2021
1 parent 75f9342 commit 7cb5b70
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/configuration/tsconfig.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as vscode from "vscode";
import * as JSON5 from "json5";
import { readFileSync } from "fs";
import { Mapping } from "./configuration.interface";

export const getWorkfolderTsConfigConfiguration = memoize(async function (
Expand All @@ -12,15 +11,15 @@ export const getWorkfolderTsConfigConfiguration = memoize(async function (

let mappings: Mapping[] = [];

files.forEach(async (file) => {
for (const file of files) {
try {
const fileContents = await vscode.workspace.fs.readFile(vscode.Uri.file(file.fsPath));
const fileUri = vscode.Uri.file(file.fsPath);
const fileContents = await vscode.workspace.fs.readFile(fileUri);
const parsedFile = JSON5.parse(fileContents.toString());
const newMappings = createMappingsFromWorkspaceConfig(parsedFile);
mappings = [...mappings, ...newMappings];
} catch {
}
});
mappings.push(...newMappings);
} catch {}
}

return mappings;
});
Expand Down

0 comments on commit 7cb5b70

Please sign in to comment.