提交 cfc1ab4c 编写于 作者: R Rachel Macfarlane

Add providerId array to authentication namespace

上级 2b029679
......@@ -76,9 +76,9 @@ declare module 'vscode' {
export const onDidChangeAuthenticationProviders: Event<AuthenticationProvidersChangeEvent>;
/**
* Returns whether a provider with providerId is currently registered.
* An array of the ids of authentication providers that are currently registered.
*/
export function hasProvider(providerId: string): boolean;
export const providerIds: string[];
/**
* Get existing authentication sessions. Rejects if a provider with providerId is not
......
......@@ -188,8 +188,8 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
get onDidChangeAuthenticationProviders(): Event<vscode.AuthenticationProvidersChangeEvent> {
return extHostAuthentication.onDidChangeAuthenticationProviders;
},
hasProvider(providerId: string): boolean {
return extHostAuthentication.hasProvider(providerId);
get providerIds(): string[] {
return extHostAuthentication.providerIds;
},
getSessions(providerId: string, scopes: string[]): Thenable<readonly vscode.AuthenticationSession[]> {
return extHostAuthentication.getSessions(extension, providerId, scopes);
......
......@@ -24,8 +24,13 @@ export class ExtHostAuthentication implements ExtHostAuthenticationShape {
this._proxy = mainContext.getProxy(MainContext.MainThreadAuthentication);
}
hasProvider(providerId: string): boolean {
return !!this._authenticationProviders.get(providerId);
get providerIds(): string[] {
const ids: string[] = [];
this._authenticationProviders.forEach(provider => {
ids.push(provider.id);
});
return ids;
}
async getSessions(requestingExtension: IExtensionDescription, providerId: string, scopes: string[]): Promise<readonly vscode.AuthenticationSession[]> {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册