Fix #244138: remove duplicate disable actions in extension dropdown#305248
Fix #244138: remove duplicate disable actions in extension dropdown#305248rupeshkumar-555 wants to merge 3 commits intomicrosoft:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adjusts enablement logic for extension enable/disable actions in the Extensions UI to prevent redundant/invalid disable actions from appearing in the Disable button dropdown, specifically for the “disabled globally but enabled in workspace” scenario.
Changes:
- Tightened
DisableGloballyActionenablement to only when an extension is enabled globally. - Tightened
DisableForWorkspaceActionenablement to only when an extension is enabled in the workspace.
| if (this.extension && this.extension.local && !this.extension.isWorkspaceScoped && this.extensionService.extensions.some(e => areSameExtensions({ id: e.identifier.value, uuid: e.uuid }, this.extension!.identifier) && this.workspaceContextService.getWorkbenchState() !== WorkbenchState.EMPTY)) { | ||
| this.enabled = this.extension.state === ExtensionState.Installed | ||
| && (this.extension.enablementState === EnablementState.EnabledGlobally || this.extension.enablementState === EnablementState.EnabledWorkspace) | ||
| && this.extension.enablementState === EnablementState.EnabledWorkspace | ||
| && this.extensionEnablementService.canChangeWorkspaceEnablement(this.extension.local); |
There was a problem hiding this comment.
DisableForWorkspaceAction is now only enabled for EnablementState.EnabledWorkspace. That makes the "Disable (Workspace)" option disappear when an extension is enabled globally (the common case), so users can no longer disable an enabled extension only for the current workspace via this UI. This also contradicts the existing unit test expectation (DisableForWorkspaceAction should be enabled for an enabled extension). Consider restoring the prior condition (enabled for EnabledGlobally OR EnabledWorkspace) and keep the fix limited to DisableGloballyAction.
74b869f to
1c021ca
Compare
|
Thank you for the review feedback! I've corrected the fix to address the concern about DisableForWorkspaceAction. Corrected FixThe issue was that I had made DisableForWorkspaceAction too restrictive. The corrected approach is:
This prevents the bug while preserving functionalityBug scenario (disabled globally + enabled in workspace):
Common scenario (enabled globally only):
The fix has been amended and pushed. Tests pass, compilation successful. Thank you! |
90e6239 to
92d8ec4
Compare
✅ PR #305248 - Comprehensive Test & Execution ReportIssue: #244138 fixed ✓ Test Results SummaryCode VerificationFile: ✅ DisableGloballyAction (line 1754):
✅ DisableForWorkspaceAction (line 1721):
Scenario Coverage - All Passing ✓
Discussion ResolutionCopilot AI feedback about Status: All tests executed, all passing, ready for review ✅ |
92d8ec4 to
8fec6a2
Compare
…ropdown When an extension is disabled globally but enabled in workspace, the disable button previously showed both 'Disable' and 'Disable (Workspace)' options, which is confusing since 'Disable' is not applicable (extension is already disabled globally). This fix restricts the enablement logic: - DisableGloballyAction: Only enabled when extension is enabled globally (prevents showing 'Disable' when not applicable) - DisableForWorkspaceAction: Kept original condition (enabled when extension is enabled in workspace OR globally, allowing users to disable globally- enabled extensions just for their workspace) This ensures correct actions appear based on extension state while maintaining full functionality for all common use cases.
8fec6a2 to
7eccf6c
Compare
Problem
When an extension is disabled globally but enabled in workspace, the Disable button previously displayed a dropdown menu with both:
This is confusing and redundant, as "Disable" is not a valid action in this context (the extension is already disabled globally).
Root Cause
The
DisableGloballyActionandDisableForWorkspaceActionclasses had identical enablement logic:Solution
Refined the enablement conditions in extensionsActions.ts:
This ensures the correct action(s) are displayed based on the extension's actual enablement state.
Testing
Scenario Coverage
Fixes #244138