Skip to content

Remove disabled "No accounts requested yet..." menu item from accounts menu #251511

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -3,17 +3,15 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { Disposable, IDisposable } from '../../../../base/common/lifecycle.js';
import { Disposable } from '../../../../base/common/lifecycle.js';
import { localize } from '../../../../nls.js';
import { MenuId, MenuRegistry, registerAction2 } from '../../../../platform/actions/common/actions.js';
import { registerAction2 } from '../../../../platform/actions/common/actions.js';
import { CommandsRegistry } from '../../../../platform/commands/common/commands.js';
import { ContextKeyExpr } from '../../../../platform/contextkey/common/contextkey.js';
import { IExtensionManifest } from '../../../../platform/extensions/common/extensions.js';
import { SyncDescriptor } from '../../../../platform/instantiation/common/descriptors.js';
import { Registry } from '../../../../platform/registry/common/platform.js';
import { IWorkbenchContribution, WorkbenchPhase, registerWorkbenchContribution2 } from '../../../common/contributions.js';
import { SignOutOfAccountAction } from './actions/signOutOfAccountAction.js';
import { IAuthenticationService } from '../../../services/authentication/common/authentication.js';
import { IBrowserWorkbenchEnvironmentService } from '../../../services/environment/browser/environmentService.js';
import { Extensions, IExtensionFeatureTableRenderer, IExtensionFeaturesRegistry, IRenderedData, IRowData, ITableData } from '../../../services/extensionManagement/common/extensionFeatures.js';
import { ManageTrustedExtensionsForAccountAction } from './actions/manageTrustedExtensionsForAccountAction.js';
@@ -80,44 +78,14 @@ const extensionFeature = Registry.as<IExtensionFeaturesRegistry>(Extensions.Exte
class AuthenticationContribution extends Disposable implements IWorkbenchContribution {
static ID = 'workbench.contrib.authentication';

private _placeholderMenuItem: IDisposable | undefined = MenuRegistry.appendMenuItem(MenuId.AccountsContext, {
command: {
id: 'noAuthenticationProviders',
title: localize('authentication.Placeholder', "No accounts requested yet..."),
precondition: ContextKeyExpr.false()
},
});

constructor(@IAuthenticationService private readonly _authenticationService: IAuthenticationService) {
constructor() {
super();
this._register(codeExchangeProxyCommand);
this._register(extensionFeature);

// Clear the placeholder menu item if there are already providers registered.
if (_authenticationService.getProviderIds().length) {
this._clearPlaceholderMenuItem();
}
this._registerHandlers();
this._registerActions();
}

private _registerHandlers(): void {
this._register(this._authenticationService.onDidRegisterAuthenticationProvider(_e => {
this._clearPlaceholderMenuItem();
}));
this._register(this._authenticationService.onDidUnregisterAuthenticationProvider(_e => {
if (!this._authenticationService.getProviderIds().length) {
this._placeholderMenuItem = MenuRegistry.appendMenuItem(MenuId.AccountsContext, {
command: {
id: 'noAuthenticationProviders',
title: localize('loading', "Loading..."),
precondition: ContextKeyExpr.false()
}
});
}
}));
}

private _registerActions(): void {
this._register(registerAction2(SignOutOfAccountAction));
this._register(registerAction2(ManageTrustedExtensionsForAccountAction));
@@ -126,11 +94,6 @@ class AuthenticationContribution extends Disposable implements IWorkbenchContrib
this._register(registerAction2(ManageAccountPreferencesForMcpServerAction));
this._register(registerAction2(RemoveDynamicAuthenticationProvidersAction));
}

private _clearPlaceholderMenuItem(): void {
this._placeholderMenuItem?.dispose();
this._placeholderMenuItem = undefined;
}
}

class AuthenticationUsageContribution implements IWorkbenchContribution {
Loading
Oops, something went wrong.