Skip to content

Fix Extension Disable Button Dropdown (#244138)#300218

Open
Harshithk951 wants to merge 2 commits intomicrosoft:mainfrom
Harshithk951:main
Open

Fix Extension Disable Button Dropdown (#244138)#300218
Harshithk951 wants to merge 2 commits intomicrosoft:mainfrom
Harshithk951:main

Conversation

@Harshithk951
Copy link

Description

This pull request addresses issue #244138, where the extension "Disable" button incorrectly displays a dropdown with redundant options when an extension is globally disabled but enabled for the current workspace.

Proposed Changes

  • Modified DisableGloballyAction.update() in src/vs/workbench/contrib/extensions/browser/extensionsActions.ts to check if the extension is already disabled globally using IExtensionEnablementService.isDisabledGlobally().
  • If the extension is already globally disabled, the action is set to disabled (effectively hidden via hideOnDisabled).
  • This ensures that only the relevant "Disable (Workspace)" button is shown, preventing confusing UI states.

Testing and Verification

Automated Verification:

  • Added a new test case to src/vs/workbench/contrib/extensions/test/electron-browser/extensionsActions.test.ts: Test DisableGloballyAction when extension is disabled globally and enabled for workspace.
  • Verified that all 242 tests in extensionsActions.test.ts pass successfully using ./scripts/test.sh.
    Manual Verification:
  1. Install an extension (e.g., Prettier).
  2. Click the gear icon on the extension page and select "Disable (Always)".
  3. Click the "Enable" button and select "Enable (Workspace)".
  4. Observe the "Disable" button; it now correctly shows only "Disable (Workspace)" as a primary button without any redundant dropdown menu.
    Fixes Disabled and enabled (workspace) extension Disable button dropdown contains both "Disable" and "Disable (Workspace)" items #244138

Copilot AI review requested due to automatic review settings March 9, 2026 17:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a VS Code Extensions UI bug where the Disable button incorrectly shows a dropdown with redundant options when an extension is disabled globally but enabled for the current workspace.

Changes:

  • Update DisableGloballyAction.update() to additionally check IWorkbenchExtensionEnablementService.isDisabledGlobally() and disable (hide) the global-disable action when it’s already globally disabled.
  • Add a regression test covering the “disabled globally + enabled workspace” state to ensure DisableGloballyAction is not enabled.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/vs/workbench/contrib/extensions/browser/extensionsActions.ts Prevents the global disable action from being shown/enabled when the extension is already disabled globally, eliminating the redundant dropdown entry.
src/vs/workbench/contrib/extensions/test/electron-browser/extensionsActions.test.ts Adds a test to validate the new enablement logic for DisableGloballyAction in the globally-disabled + workspace-enabled scenario.

You can also share your feedback on Copilot code review. Take the survey.

@Harshithk951
Copy link
Author

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disabled and enabled (workspace) extension Disable button dropdown contains both "Disable" and "Disable (Workspace)" items

3 participants