Skip to content
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

Add experimental prepareForHotExit method for custom editors #88948

Merged
merged 1 commit into from
Jan 24, 2020

Conversation

mjbvz
Copy link
Collaborator

@mjbvz mjbvz commented Jan 20, 2020

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?

@mjbvz mjbvz self-assigned this Jan 20, 2020
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 mjbvz force-pushed the prepareForHotExit-prototype branch from 2691bf2 to f6dd919 Compare January 24, 2020 00:13
@mjbvz mjbvz added this to the January 2020 milestone Jan 24, 2020
@mjbvz mjbvz merged commit f3dbcea into microsoft:master Jan 24, 2020
@mjbvz 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