-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
Adopt new extension host restart lifecycle #180514
Comments
@bpasero I'm wondering if this can be done in one level up, for example, implement the saving all logic in |
But |
@bpasero Would like to see the end - end flow with this API - Lets say user switches the profile and one of the components veto it. In this case what does user see? If user decides to veto (cancel) it, what is expected to do by the component triggering the action to stop extension hosts. May be instead of returning a boolean value, does it makes sense to throw a cancellation error? |
Nothing, the operation is stopped. Compare this with closing a dirty editor and pressing "Cancel"
The expectation is to then not restart the extension host and unwind anything that was done as part of the flow (if any). Here is how workspaces do it: vscode/src/vs/workbench/services/workspaces/electron-sandbox/workspaceEditingService.ts Lines 156 to 160 in c7581b5
|
I am more particular about the dialog shown by the components for vetoing. For example, what kind of dialog Notebooks show? This dialog shall have the information about the user action and not the internal details like extension host is being restarted. I am expecting in the profile switch scenario, the veto dialog shall say something like Would you like to save the notebook before switching the profile? If so, the |
Yeah I like that, maybe as part of the call to |
I think, this is better for the components |
Adding a new I think its good that a component opens a dialog because a component will have to deal with all the buttons and actions. Components can now show |
Thinking that the extension service should inform the user on veto, like so: The first message is the The second details message lists the reason why the operation was blocked and should also read accordingly @mjbvz and @rebornix |
* Adopt ext host restart for custom editors For #180514 * Show notification when restart is vetoed
✅ |
Thanks, I think we only miss workspace trust and notebooks 🙏 |
I think this is in very good shape now. Workspace trust transition cannot be fully cancelled, but the data loss scenario is mitigated with the veto support we have. |
Synopsis
We allow the extension host to be restarted in certain cases. Today this happens without any support for asking components whether they can support a restart and so issues arise.
#180513 introduces a new
IExtensionService.onWillStop
event that listeners canveto(boolean | Promise<boolean>)
, for example:This allows to:
In addition the method
IExtensionService.stopExtensionHosts()
is now aPromise<boolean>
and callers must await the result before proceeding. For example:Related Issues
Some components cannot support EH restart without doing some operation first before the EH goes down, for example:
Adoption
boolean
return type ofstopExtensionHosts
here @lszomoruboolean
return type ofstopExtensionHosts
here @sandy081The text was updated successfully, but these errors were encountered: