async getProjects()

in vscode/qodana/src/core/auth/index.ts [157:179]


    async getProjects(): Promise<MatchingProject[] | undefined> {
        let remote = getRemoteOrigin();
        if (!remote) {
            return undefined;
        }
        let httpRemote = convertSshToHttp(remote);
        let authorized = this.lastState as AuthorizedImpl;
        if (authorized) {
            let withoutSuffix = httpRemote.replace(/\.git$/, '');
            let sshRemoteWithoutSuffix = convertHttpToSsh(httpRemote);
            const createUrls = (url: string) => [url, `ssh://${url}`, `${url}.git`, `ssh://${url}.git`];
            let promises =
                [withoutSuffix, `${withoutSuffix}.git`, ...createUrls(sshRemoteWithoutSuffix[0]),
                    ...createUrls(sshRemoteWithoutSuffix[1])].flatMap( async(repoUrl) => {
                let response = await authorized.qodanaCloudUserApi((api) => {
                    return api.getProjectsByOriginUrl(repoUrl);
                });
                return response ? response.matchingProjects : [];
            });
            return Promise.all(promises).then((projects) => projects.flat());
        }
        return undefined;
    }