UX: Add 'Don't Show Again' prompt for restarting extensions#285658
UX: Add 'Don't Show Again' prompt for restarting extensions#285658murataslan1 wants to merge 1 commit intomicrosoft:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR enhances the user experience in the Runtime Extensions Editor by adding an informative prompt when disabling extensions. The prompt asks users if they want to restart extensions immediately to apply the changes, with a "Don't Show Again" option for users who prefer not to be prompted in the future.
Key Changes:
- Adds a new private method
_disableExtensionWithPromptthat wraps extension disabling with a user prompt - Integrates storage service to persist user's "Don't Show Again" preference
- Updates disable action handlers to use the new prompt mechanism
| const restart = new Action('restart', nls.localize('restart', "Restart Extensions"), undefined, true, async () => { | ||
| await this._extensionService.stopExtensionHosts(); | ||
| await this._extensionService.startExtensionHosts(); | ||
| }); | ||
|
|
||
| this._notificationService.prompt( | ||
| Severity.Info, | ||
| nls.localize('finishDisable', "Extension disabled. Restart extensions to take effect?"), | ||
| [{ | ||
| label: nls.localize('restart', "Restart Extensions"), | ||
| run: () => restart.run() |
There was a problem hiding this comment.
The Action object created here is never used. The action is created but then the prompt uses a new inline object with a 'run' callback that calls 'restart.run()'. This adds unnecessary complexity. Consider removing the Action object creation and directly calling the extension service methods in the inline callback.
| const restart = new Action('restart', nls.localize('restart', "Restart Extensions"), undefined, true, async () => { | |
| await this._extensionService.stopExtensionHosts(); | |
| await this._extensionService.startExtensionHosts(); | |
| }); | |
| this._notificationService.prompt( | |
| Severity.Info, | |
| nls.localize('finishDisable', "Extension disabled. Restart extensions to take effect?"), | |
| [{ | |
| label: nls.localize('restart', "Restart Extensions"), | |
| run: () => restart.run() | |
| this._notificationService.prompt( | |
| Severity.Info, | |
| nls.localize('finishDisable', "Extension disabled. Restart extensions to take effect?"), | |
| [{ | |
| label: nls.localize('restart', "Restart Extensions"), | |
| run: async () => { | |
| await this._extensionService.stopExtensionHosts(); | |
| await this._extensionService.startExtensionHosts(); | |
| } |
| Severity.Info, | ||
| nls.localize('finishDisable', "Extension disabled. Restart extensions to take effect?"), | ||
| [{ | ||
| label: nls.localize('restart', "Restart Extensions"), |
There was a problem hiding this comment.
The localization key 'restart' is used twice (lines 522 and 531) with the same text "Restart Extensions". This creates duplicate entries in the localization files. Consider defining the localized string once and reusing it, or use different keys if the contexts are meant to be different.
| } | ||
|
|
||
| const restart = new Action('restart', nls.localize('restart', "Restart Extensions"), undefined, true, async () => { | ||
| await this._extensionService.stopExtensionHosts(); |
There was a problem hiding this comment.
The 'stopExtensionHosts' method accepts an optional message parameter (seen in other parts of the codebase like extensionsWorkbenchService.ts line 1628 and extensionEnablementWorkspaceTrustTransitionParticipant.ts line 42). Consider passing a descriptive message for why the extension hosts are being stopped, such as 'Restarting after disabling extension', to provide better context for debugging and user feedback.
| await this._extensionService.stopExtensionHosts(); | |
| await this._extensionService.stopExtensionHosts('Restarting after disabling extension'); |
Adds a user-friendly prompt when disabling extensions in the Runtime Extensions Editor, asking if the user wants to restart immediately. Includes a 'Don't Show Again' option for convenience. This polish improves the user experience when managing extensions.