Skip to content

Git: Restore diff editors on reload #99290

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

Closed
yj7 opened this issue Jun 3, 2020 · 18 comments
Closed

Git: Restore diff editors on reload #99290

yj7 opened this issue Jun 3, 2020 · 18 comments
Assignees
Labels
diff-editor Diff editor issues feature-request Request for new features or functionality on-release-notes Issue/pull request mentioned in release notes verification-needed Verification of issue is requested verified Verification succeeded workbench-editors Managing of editor widgets in workbench window
Milestone

Comments

@yj7
Copy link

yj7 commented Jun 3, 2020

  • VSCode Version: 1.45.1
  • OS Version: Win 10

Steps to Reproduce:

  1. Open a project with git configured
  2. Open changes of a file using the source control section
  3. Close VSCode
  4. Relaunch VSCode

All other tabs will be opened except git diff changes tab

Does this issue occur when all extensions are disabled?: Yes

@alexdima
Copy link
Member

alexdima commented Jun 3, 2020

Yes, +100 !!

@alexdima alexdima assigned joaomoreno and alexdima and unassigned alexdima and joaomoreno Jun 3, 2020
@joaomoreno
Copy link
Member

@bpasero What will it take for this to happen? This is a simple diff editor with a git document (from a custom file system) on the left side.

I also have a feeling we got this to work recently. 🤔

@joaomoreno joaomoreno added the bug Issue identified by VS Code Team member as probable bug label Jun 4, 2020
@joaomoreno joaomoreno added this to the June 2020 milestone Jun 4, 2020
@bpasero
Copy link
Member

bpasero commented Jun 4, 2020

@joaomoreno you need to register an editor input factory for anything you want to restore.

@joaomoreno
Copy link
Member

I am (git is) an extension. Should I assign this to you or @alexdima?

@bpasero
Copy link
Member

bpasero commented Jun 4, 2020

Oh wait. Ever since you adopted the file system provider API, the editor input factory is already there for you. However, we do not restore diff editors in general currently.

Is it safe to assume that a Git URL can simply be opened again in the future?

@joaomoreno
Copy link
Member

joaomoreno commented Jun 4, 2020

Is it safe to assume that a Git URL can simply be opened again in the future?

Pretty safe!

boom

@bpasero
Copy link
Member

bpasero commented Jun 4, 2020

Ok. Then this essentially is a duplicate of #18681

@joaomoreno
Copy link
Member

But that is out of scope 🤔

@bpasero
Copy link
Member

bpasero commented Jun 5, 2020

Yeah, I am fine making this a feature request and backlog candidate to see if it gets enough votes.

@joaomoreno joaomoreno changed the title Git diff tab is not restored when reopening vscode Restore diff editors on reload Jun 5, 2020
@joaomoreno joaomoreno removed their assignment Jun 5, 2020
@joaomoreno joaomoreno added feature-request Request for new features or functionality and removed bug Issue identified by VS Code Team member as probable bug labels Jun 5, 2020
@joaomoreno joaomoreno added the workbench-editors Managing of editor widgets in workbench window label Jun 5, 2020
@bpasero bpasero added the diff-editor Diff editor issues label Jun 5, 2020
@bpasero
Copy link
Member

bpasero commented Jun 9, 2020

So, with 1428d44 pushed, diff editors now have a chance to survive reloads and this works OK unless the diff editor on a git resource is opened as the active one:

recording

However, if the diff editor is the active one, I am greeted with:

ERR ENOPRO: No file system provider found for resource 'git:/Users/bpasero/Desktop/test-ts/package.json?%7B%22path%22%3A%22%2FUsers%2Fbpasero%2FDesktop%2Ftest-ts%2Fpackage.json%22%2C%22ref%22%3A%22~%22%7D'

I think we are trying to restore editors before the extension host is there.

@sandy081 @jrieken @alexdima does this ring a bell? I remember we had nasty deadlocks if the editors would wait to restore before the extension host was ready. Is this simply not supported?

@jrieken
Copy link
Member

jrieken commented Jun 9, 2020

This should work - you can reload successfully with a file from remotes open, e.g with dev containers. This might be because git activates on * which means that we don't wait for it

@bpasero
Copy link
Member

bpasero commented Jun 9, 2020

@jrieken yeah good point, though I thought we might be doing something very special for vscode-remote resources so this works.

@joaomoreno can you chime in as well how git gets activated?

@bpasero bpasero changed the title Restore diff editors on reload Git: Restore diff editors on reload Jun 9, 2020
@bpasero
Copy link
Member

bpasero commented Jun 9, 2020

I am getting a step closer once I add this to package.json for git:

"activationEvents": [
  "*",
  "onFileSystem:git"
]

However reloading then I am presented with the following error which makes me think that maybe the git FS provider is maybe not ready yet?

 ERR Error: Unable to read file 'git:/Users/bpasero/Desktop/test-ts/CHANGELOG.md?{"path":"/Users/bpasero/Desktop/test-ts/CHANGELOG.md","ref":"~"}' (EntryNotFound (FileSystemError))
    at FileService.doReadAsFileStream (fileService.js:353)
    at processTicksAndRejections (internal/process/task_queues.js:85)

@bpasero bpasero self-assigned this Jun 9, 2020
@bpasero bpasero modified the milestones: Backlog Candidates, June 2020 Jun 9, 2020
@joaomoreno
Copy link
Member

Hm... good work. I can make the git FS provider wait until the git extension is initialized and has scanned the possible repositories.

@joaomoreno
Copy link
Member

Done! 24f1b69

@bpasero bpasero added the verification-needed Verification of issue is requested label Jun 26, 2020
@bpasero
Copy link
Member

bpasero commented Jun 26, 2020

Verification:

  • open a couple of diff editors (from changes view)
  • close VSCode
  • start again
  • verify diff editors restore and show changes properly

@bpasero bpasero added the on-release-notes Issue/pull request mentioned in release notes label Jun 26, 2020
@isidorn isidorn added the verified Verification succeeded label Jun 30, 2020
@isidorn
Copy link
Contributor

isidorn commented Jun 30, 2020

Thanks for doing this. Works nicely.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
diff-editor Diff editor issues feature-request Request for new features or functionality on-release-notes Issue/pull request mentioned in release notes verification-needed Verification of issue is requested verified Verification succeeded workbench-editors Managing of editor widgets in workbench window
Projects
None yet
Development

No branches or pull requests

7 participants
@joaomoreno @bpasero @jrieken @isidorn @alexdima @yj7 and others