Total nr of files in workspace

This commit is contained in:
Elio Struyf
2021-11-25 12:59:49 +01:00
parent 2b2e256b8f
commit b7d4e547a1
+11
View File
@@ -17,6 +17,8 @@ export class Diagnostics {
folderData.push(await Diagnostics.processFolder(folder, projectName));
}
const all = await Diagnostics.allProjectFiles();
const logging = `# Project name
${projectName}
@@ -29,6 +31,10 @@ ${folders.map(f => `- ${f.title}: "${f.path}"`).join("\n")}
${wsFolder ? wsFolder.fsPath : "No workspace folder"}
# Total files
${all}
# Folders to search files
${folderData.join("\n")}
@@ -37,6 +43,11 @@ ${folderData.join("\n")}
ContentProvider.show(logging, `${projectName} diagnostics`, "markdown", ViewColumn.One);
}
private static async allProjectFiles() {
const allFiles = await workspace.findFiles(`**/*.*`);
return `Total files found: ${allFiles.length}`;
}
private static async processFolder(folder: ContentFolder, projectName: string) {
let projectStart = folder.path.split(projectName).pop();
projectStart = projectStart || "";