refactored mainthreadauth with silent option and tests (#135503)

This commit is contained in:
Tyler James Leonhardt
2021-10-20 12:17:06 -07:00
committed by GitHub
parent fb0e4870b3
commit c71e201bed
6 changed files with 419 additions and 244 deletions

View File

@@ -226,12 +226,12 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
const authentication: typeof vscode.authentication = {
getSession(providerId: string, scopes: readonly string[], options?: vscode.AuthenticationGetSessionOptions) {
if (options?.forceNewSession) {
if (options?.forceNewSession || options?.silent) {
checkProposedApiEnabled(extension);
}
return extHostAuthentication.getSession(extension, providerId, scopes, options as any);
},
// TODO: optimize this API to only return the boolean over the wire
// TODO: remove this after GHPR and Codespaces move off of it
async hasSession(providerId: string, scopes: readonly string[]) {
checkProposedApiEnabled(extension);
return !!(await extHostAuthentication.getSession(extension, providerId, scopes, { solelyCheckExistence: true } as any));