Skip to content

Add experimental prepareForHotExit method for custom editors - #88948

Merged
Matt Bierner (mjbvz) merged 1 commit into
microsoft:masterfrom
mjbvz:prepareForHotExit-prototype
Jan 24, 2020
Merged

Matt Bierner (mjbvz) merged 1 commit into
microsoft:masterfrom
mjbvz:prepareForHotExit-prototype

Conversation

@mjbvz

Copy link
Copy Markdown
Contributor

For #88719

Adds an experimental prepareForHotExit method to the custom editor API proposal. This method allows custom editors to hook in to VS Code's hot exit behavior

If prepareForHotExit is not implemented, VS Code will assume that the custom editor cannot be hot exited.

If prepareForHotExit is implemented, VS Code will invoke the method after every edit (this is debounced). At this point, this extension should back up the current resource. The result is a promise indicating if the backup was successful or not

VS Code will only hot exit if all backups were successful.

This is only a first draft of the potential API. I'm working on testing this with the example custom editor extensions. Some open questions:

  • Does prepareForHotExit provide enough for extensions to impement hot exit?
  • How do we notify extensions that they can get rid of their old backups (such as when the user enables auto save)
  • Does this work properly on both web and desktop?

Adds a backup method to the custom editor API proposal. This method allows custom editors to hook in to VS Code's hot exit behavior

If `backup` is not implemented, VS Code will assume that the custom editor cannot be hot exited.

When `backup` is implemented, VS Code will invoke the method after every edit (this is debounced). At this point, this extension should back up the current resource.  The result is a promise indicating if the backup was successful or not

VS Code will only hot exit if all backups were successful.
@mjbvz
Matt Bierner (mjbvz) force-pushed the prepareForHotExit-prototype branch from 2691bf2 to f6dd919 Compare January 24, 2020 00:13
@mjbvz Matt Bierner (mjbvz) added this to the January 2020 milestone Jan 24, 2020
@mjbvz
Matt Bierner (mjbvz) merged commit f3dbcea into microsoft:master Jan 24, 2020
@mjbvz
Matt Bierner (mjbvz) deleted the prepareForHotExit-prototype branch January 24, 2020 00:14
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant