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

use scratchpad for IW working copy #184757

Merged
merged 16 commits into from
Jun 21, 2023
Merged

use scratchpad for IW working copy #184757

merged 16 commits into from
Jun 21, 2023

Conversation

amunger
Copy link
Contributor

@amunger amunger commented Jun 9, 2023

  • Remove the Interactive file scheme and FS provider as they will now be untitled files
  • Use the notebook serializer for the IW to simplify saving as an ipynb
    • save as will save and re-open as an ipynb
  • Stop registering the notebook editor for *.interactive to prevent overwriting the interactive contributions
  • Use untyped input for editorService.OpenEditor to adopt the editor resolver, rather than creating the editorInput ourselves
    • required for letting the WCS handle backup recovery

@amunger amunger requested review from rebornix and bpasero June 20, 2023 16:37
@bpasero
Copy link
Member

bpasero commented Jun 20, 2023

I am not deep in any of the code of this PR, is there something specifically you want me to review here? Otherwise I would yield for Pung.

@amunger
Copy link
Contributor Author

amunger commented Jun 20, 2023

@bpasero - mostly the change in editor registration and usage of the editor service resolver, though I think I have it pretty figured out. Plus you added the 👀, so I figured you wanted to review

extensions/ipynb/package.json Outdated Show resolved Hide resolved
this._contributedEditorDisposables.add(editorRegistration);
let editorRegistration: IDisposable | undefined;
// Don't overwrite editor contributions if they come from elsewhere
if (!info.externalEditor) {
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we can have better name to indicate that we only want to register the notebook provider info (for resolving notebook model) but we don't want to register an editor.

@amunger
Copy link
Contributor Author

amunger commented Jun 21, 2023

Actually @bpasero, there is a remaining issue that I will probably want your review on, but I didn't manage to get it done today:

When closing without hot exit:

  • Reverting doesn't drop the IW backup. I think that's because we don't fire onDidChangeDirty for scratchpads (so might end up needing a new event pipeline)
  • Saving doesn't save the editor in Editor.SaveAll because it only looks for dirty editors to save. It saves on the working copy instead, which doesn't use the suggested target, and also leaves the old editor tab open.

@bpasero
Copy link
Member

bpasero commented Jun 21, 2023

@amunger is that something for a follow up issue or blocking this PR? if its not blocking then maybe we can do that in a new issue to get this change rolling?

Reverting doesn't drop the IW backup. I think that's because we don't fire onDidChangeDirty for scratchpads (so might end up needing a new event pipeline)

I think my expectation for a reverted scratchpad is that it disposes because there is no other state to revert to. And when it does, we would drop the backup as well:

private onDidUnregister(workingCopy: IWorkingCopy): void {
// Remove from content version map
this.mapWorkingCopyToContentVersion.delete(workingCopy);
// Check suspended
if (this.suspended) {
this.logService.warn(`[backup tracker] suspended, ignoring unregister event`, workingCopy.resource.toString(), workingCopy.typeId);
return;
}
// Discard backup
this.discardBackup(workingCopy);
}

Looking at the code, that should already happen today:

// A reverted untitled file working copy is invalid
// because it has no actual source on disk to revert to.
// As such we dispose the model.
this.dispose();

Saving doesn't save the editor in Editor.SaveAll because it only looks for dirty editors to save.

Maybe we need to add a new option for saveAll to even include scratchpads only for this case because here we know we really need to save all editors, including scratchpads.

@amunger
Copy link
Contributor Author

amunger commented Jun 21, 2023

it would definitely make sense to put it in a separate change, so I'll follow up with that fix after this is merged

@amunger amunger merged commit 1a3cc15 into main Jun 21, 2023
@amunger amunger deleted the aamunger/fileBackedIW branch June 21, 2023 13:15
@github-actions github-actions bot locked and limited conversation to collaborators Aug 5, 2023
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.

4 participants