diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 1a8a0024670..5303acb0526 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -202,9 +202,9 @@ declare module 'vscode' { * @param providerId The id of the provider to use * @param scopes A list of scopes representing the permissions requested. These are dependent on the authentication provider * @param options The [getSessionOptions](#GetSessionOptions) to use - * @returns A thenable that resolves to an authentication session if available, or undefined if there are no sessions + * @returns A thenable that resolves to an authentication session */ - export function getSession(providerId: string, scopes: string[], options: AuthenticationGetSessionOptions): Thenable; + export function getSession(providerId: string, scopes: string[], options: AuthenticationGetSessionOptions & { createIfNone: true }): Thenable; /** * Get an authentication session matching the desired scopes. Rejects if a provider with providerId is not @@ -214,9 +214,9 @@ declare module 'vscode' { * @param providerId The id of the provider to use * @param scopes A list of scopes representing the permissions requested. These are dependent on the authentication provider * @param options The [getSessionOptions](#GetSessionOptions) to use - * @returns A thenable that resolves to an authentication session + * @returns A thenable that resolves to an authentication session if available, or undefined if there are no sessions */ - export function getSession(providerId: string, scopes: string[], options: AuthenticationGetSessionOptions & { createIfNone: true }): Thenable; + export function getSession(providerId: string, scopes: string[], options: AuthenticationGetSessionOptions): Thenable; /** * @deprecated diff --git a/src/vs/workbench/api/common/extHost.api.impl.ts b/src/vs/workbench/api/common/extHost.api.impl.ts index fff2dc8002e..e55ff20403f 100644 --- a/src/vs/workbench/api/common/extHost.api.impl.ts +++ b/src/vs/workbench/api/common/extHost.api.impl.ts @@ -199,8 +199,8 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I hasSessions(providerId: string, scopes: string[]): Thenable { return extHostAuthentication.hasSessions(providerId, scopes); }, - getSession(providerId: string, scopes: string[], options: vscode.AuthenticationGetSessionOptions): Thenable { - return extHostAuthentication.getSession(extension, providerId, scopes, options); + getSession(providerId: string, scopes: string[], options: vscode.AuthenticationGetSessionOptions) { + return extHostAuthentication.getSession(extension, providerId, scopes, options as any); }, getSessions(providerId: string, scopes: string[]): Thenable { return extHostAuthentication.getSessions(extension, providerId, scopes); diff --git a/src/vs/workbench/api/common/extHostAuthentication.ts b/src/vs/workbench/api/common/extHostAuthentication.ts index 0ffdaff9d14..60714ed4203 100644 --- a/src/vs/workbench/api/common/extHostAuthentication.ts +++ b/src/vs/workbench/api/common/extHostAuthentication.ts @@ -43,6 +43,7 @@ export class ExtHostAuthentication implements ExtHostAuthenticationShape { return !!(await provider.getSessions()).filter(session => session.scopes.sort().join(' ') === orderedScopes).length; } + async getSession(requestingExtension: IExtensionDescription, providerId: string, scopes: string[], options: vscode.AuthenticationGetSessionOptions & { createIfNone: true }): Promise; async getSession(requestingExtension: IExtensionDescription, providerId: string, scopes: string[], options: vscode.AuthenticationGetSessionOptions): Promise { const provider = this._authenticationProviders.get(providerId); if (!provider) {