Skip to content

Conversation

@prathamanvekar
Copy link

Fixes #244138

Description
The "Disable" button was incorrectly appearing in the extension dropdown menu even when the extension was already disabled globally (but enabled for the current workspace). This resulted in both "Disable" and "Disable (Workspace)" appearing simultaneously, which is redundant.

This fix adds a check to DisableGloballyAction.update() to ensure the global "Disable" action is hidden if the extension is already globally disabled.

Testing

  1. Installed a built-in extension (e.g., Markdown Language Features).
  2. Disabled it globally.
  3. Opened a folder to create a workspace context.
  4. Enabled the extension for the current workspace.
  5. Verified that the dropdown now only shows "Disable (Workspace)" and correctly hides the redundant "Disable" option.

Screenshots
Before:
Screenshot 2026-01-21 134016

After:
Screenshot 2026-01-21 135004

Copilot AI review requested due to automatic review settings January 21, 2026 08:38
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

This PR fixes a bug where the "Disable" action incorrectly appeared in the extension dropdown menu when an extension was already disabled globally but enabled for the current workspace, resulting in both "Disable" and "Disable (Workspace)" appearing simultaneously.

Changes:

  • Added a check to DisableGloballyAction.update() to hide the action when the extension is already globally disabled

&& (this.extension.enablementState === EnablementState.EnabledGlobally || this.extension.enablementState === EnablementState.EnabledWorkspace)
&& this.extensionEnablementService.canChangeEnablement(this.extension.local);
&& this.extensionEnablementService.canChangeEnablement(this.extension.local)
&& !this.extensionEnablementService.isDisabledGlobally(this.extension.local);
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

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

Consider adding a test case to verify that DisableGloballyAction is disabled when an extension is disabled globally but enabled for the workspace. This would cover the specific scenario fixed by this PR. The test file at src/vs/workbench/contrib/extensions/test/electron-browser/extensionsActions.test.ts has tests for other scenarios but not this one.

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

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

Added the requested unit test case to verify the fix.

@prathamanvekar
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

2 participants