Skip to content

Adopt new extension host restart lifecycle #180514

Closed
@bpasero

Description

@bpasero

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:

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 boolean return type of stopExtensionHosts here @lszomoru
  • Profiles need to adopt the new boolean return type of stopExtensionHosts here @sandy081

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions