in src/utils.ts [755:790]
export async function reportFileExtensionTypes(telemetryReporter: Readonly<TelemetryReporter>): Promise<void> {
const files = await vscode.workspace.findFiles('**/*.*', '**/node_modules/**');
const extensionMap: Map<string, number> = new Map<string, number>([
['html', 0],
['css', 0],
['js', 0],
['ts', 0],
['jsx', 0],
['scss', 0],
['json', 0],
['mjs', 0],
['other', 0],
]);
for (const file of files) {
const extension: string | undefined = file.path.split('.').pop();
if (extension) {
if (extensionMap.has(extension)) {
const currentValue = extensionMap.get(extension);
if (currentValue !== undefined) {
extensionMap.set(extension, currentValue + 1);
}
} else {
const otherCount = extensionMap.get('other');
if (otherCount !== undefined) {
extensionMap.set('other', otherCount + 1);
}
}
}
}
extensionMap.set('total', files.length);
// Creates Object from map
const fileTypes: {[key: string]: number} = {};
Object.assign(fileTypes, ...[...extensionMap.entries()].map(([k, v]) => ({[k]: v})));
telemetryReporter.sendTelemetryEvent('workspace/metadata', undefined, fileTypes);
}