diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 209ae8df9d0..73f79fd819e 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -25,6 +25,21 @@ declare module 'vscode' { scopes: string[] } + /** + * An [event](#Event) which fires when an [AuthenticationProvider](#AuthenticationProvider) is added or removed. + */ + export interface AuthenticationProvidersChangeEvent { + /** + * The ids of the [authenticationProvider](#AuthenticationProvider)s that have been added. + */ + readonly added: string[]; + + /** + * The ids of the [authenticationProvider](#AuthenticationProvider)s that have been removed.. + */ + readonly removed: string[]; + } + export interface AuthenticationProvider { /** * Used as an identifier for extensions trying to work with a particular @@ -33,6 +48,11 @@ declare module 'vscode' { */ readonly id: string; readonly displayName: string; + + /** + * A [enent](#Event) which fires when the array of sessions has changed, or data + * within a session has changed. + */ readonly onDidChangeSessions: Event; /** @@ -53,8 +73,7 @@ declare module 'vscode' { /** * Fires with the provider id that was registered or unregistered. */ - export const onDidRegisterAuthenticationProvider: Event; - export const onDidUnregisterAuthenticationProvider: Event; + export const onDidChangeAuthenticationProviders: Event; export const providers: ReadonlyArray; } diff --git a/src/vs/workbench/api/common/extHost.api.impl.ts b/src/vs/workbench/api/common/extHost.api.impl.ts index 91045fcda6c..897af14d451 100644 --- a/src/vs/workbench/api/common/extHost.api.impl.ts +++ b/src/vs/workbench/api/common/extHost.api.impl.ts @@ -188,11 +188,8 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I get providers() { return extHostAuthentication.providers(extension); }, - get onDidRegisterAuthenticationProvider() { - return extHostAuthentication.onDidRegisterAuthenticationProvider; - }, - get onDidUnregisterAuthenticationProvider() { - return extHostAuthentication.onDidUnregisterAuthenticationProvider; + get onDidChangeAuthenticationProviders(): Event { + return extHostAuthentication.onDidChangeAuthenticationProviders; } }; diff --git a/src/vs/workbench/api/common/extHostAuthentication.ts b/src/vs/workbench/api/common/extHostAuthentication.ts index c4518b0a407..326610264f7 100644 --- a/src/vs/workbench/api/common/extHostAuthentication.ts +++ b/src/vs/workbench/api/common/extHostAuthentication.ts @@ -55,11 +55,8 @@ export class ExtHostAuthentication implements ExtHostAuthenticationShape { private _proxy: MainThreadAuthenticationShape; private _authenticationProviders: Map = new Map(); - private _onDidRegisterAuthenticationProvider = new Emitter(); - readonly onDidRegisterAuthenticationProvider: Event = this._onDidRegisterAuthenticationProvider.event; - - private _onDidUnregisterAuthenticationProvider = new Emitter(); - readonly onDidUnregisterAuthenticationProvider: Event = this._onDidUnregisterAuthenticationProvider.event; + private _onDidChangeAuthenticationProviders = new Emitter(); + readonly onDidChangeAuthenticationProviders: Event = this._onDidChangeAuthenticationProviders.event; constructor(mainContext: IMainContext) { this._proxy = mainContext.getProxy(MainContext.MainThreadAuthentication); @@ -83,13 +80,13 @@ export class ExtHostAuthentication implements ExtHostAuthenticationShape { }); this._proxy.$registerAuthenticationProvider(provider.id, provider.displayName); - this._onDidRegisterAuthenticationProvider.fire(provider.id); + this._onDidChangeAuthenticationProviders.fire({ added: [provider.id], removed: [] }); return new Disposable(() => { listener.dispose(); this._authenticationProviders.delete(provider.id); this._proxy.$unregisterAuthenticationProvider(provider.id); - this._onDidUnregisterAuthenticationProvider.fire(provider.id); + this._onDidChangeAuthenticationProviders.fire({ added: [], removed: [provider.id] }); }); }