-
Notifications
You must be signed in to change notification settings - Fork 35.7k
Closed
Labels
custom-editorsCustom editor API (webview based editors)Custom editor API (webview based editors)debtCode quality issuesCode quality issuesextension-hostExtension host issuesExtension host issuesnotebookon-testplan
Milestone
Description
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 can veto(boolean | Promise<boolean>), for example:
// sync
extensionService.onWillStop(e => e.veto(true, 'component id'));
// async
extensionService.onWillStop(e => e.veto(Promise.resolve(true), 'component id'));This allows to:
- veto the restart and thus prevent it
- prolong the restart until work has finished without preventing the restart
In addition the method IExtensionService.stopExtensionHosts() is now a Promise<boolean> and callers must await the result before proceeding. For example:
const stopped = await this.extensionService.stopExtensionHosts();
if (!stopped) {
return;
}Related Issues
Some components cannot support EH restart without doing some operation first before the EH goes down, for example:
- Data loss: Custom editors do not properly deal with extension host restarts #122992
- Handle EH restart gracefully to avoid notebook working copy data loss #179224
Adoption
- Notebook component should make sure dirty and untitled notebooks are saved before the EH restarts @rebornix
- Custom editor component should make sure dirty and untitled custom editors are saved @mjbvz
- Workspace trust needs to adopt the new
booleanreturn type ofstopExtensionHostshere @lszomoru - Profiles need to adopt the new
booleanreturn type ofstopExtensionHostshere @sandy081
Metadata
Metadata
Labels
custom-editorsCustom editor API (webview based editors)Custom editor API (webview based editors)debtCode quality issuesCode quality issuesextension-hostExtension host issuesExtension host issuesnotebookon-testplan