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

Change hot exit to create new files for each backup #12377

Merged
merged 3 commits into from
Jun 16, 2020

Conversation

DonJayamanne
Copy link

For #12376
For #10496

Changes due to the way VSC works.

  • After VSC calls the backup method, the previous backup is deleted.
  • This means each backup is unique (hence the backup id must be unique)

Fix for VSC Notebooks and Custom Editor (

const id = this.storage.getBackupId(model);
this.storage.backup(model, cancellation).ignoreErrors();
const id = this.storage.generateBackupId(model);
await this.storage.backup(model, cancellation, id);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to wait here

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think awaiting here screwed up the custom editor. Can you try it an make sure it still works?

return {
id,
delete: () => this.storage.deleteBackup(model).ignoreErrors() // This cleans up after save has happened.
delete: () => this.storage.deleteBackup(model, id).ignoreErrors() // This cleans up after save has happened.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete the back associated with this id, hence passing the id.

@@ -175,12 +175,16 @@ export class NativeEditorProvider implements INotebookEditorProvider, CustomEdit
return this.open(uri);
}

public async loadModel(file: Uri, contents?: string, skipDirtyContents?: boolean) {
public async loadModel(file: Uri, contents?: string, skipDirtyContents?: boolean): Promise<INotebookModel>;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backwards compatibility with old code, hopefully when custom editor is used we can blow away skipDirtyContents completely..

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@DonJayamanne DonJayamanne merged commit c646c19 into microsoft:master Jun 16, 2020
@DonJayamanne DonJayamanne deleted the changeHotExit branch June 16, 2020 20:58
@lock lock bot locked as resolved and limited conversation to collaborators Jun 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
no-changelog No news entry required
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants