export async function getLanguagesInWorkspace()

in vscode/qodana/src/core/cli/language.ts [66:85]


export async function getLanguagesInWorkspace() {
    const langsAndCounts = new Map<string, number>();
    const files = await vscode.workspace.findFiles('**/*.*', '', 1000);
    files.forEach(file => {
        const extension = vscode.workspace.asRelativePath(file).split('.').pop();
        if (extension) {
            let language = extensionToLanguageMap.get(extension);
            if (language) {
                language.forEach(lang => {
                    langsAndCounts.set(lang, (langsAndCounts.get(lang) || 0) + 1);
                });
            }
        }
    });
    // sort by count and return only the list of languages
    langsAndCounts[Symbol.iterator] = function* () {
        yield* [...this.entries()].sort((a, b) => b[1] - a[1]);
    };
    return Array.from(langsAndCounts.keys());
}