-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Git: stale editor inputs hanging around #18651
Comments
There's no control of this from an extension side. The current API has:
What I would need is an |
Unsure what to do there. The API just talks about content provider so I am unsure if they should be allows to define the lifecycle of the document... Maybe the issue is that we don't have a nice dispose story for virtual documents. @joaomoreno Would it help if we start to dispose virtual document more clever? So start to ref count them and instead of the 3mins rule we could say virtual documents get disposed when they aren't 'used' anymore - where used means on the extension host not referenced anymore and on the main side not visible anymore. |
That does work if the extension also participates in the ref counting. 👍 |
I can investigate... |
@joaomoreno @jrieken did you guys figure out a solution? I think today the experience is pretty bad with diff editors piling up from working tree and index even though I already committed my stuff. I think we need an explicit way for extension (or any document provider) to indicate when a resource is no longer valid. I would need the same once |
Last time I talked to @joaomoreno we figured its the workbench not releasing the inputs but I could be wrong |
@jrieken The workbench doesn't know when it can release the inputs. There's a concept missing: the death of a Resource, regardless of how many people are holding on to its TextModel. |
Is this still an issue? Do inputs couple their lifecycle to editor model references? My understanding is that with the latest change @bpasero did the input just holds a reference and doesn't look at what models are alive |
I think the missing concept is still that a resource text content provider can signal any editors associated to a resource should be disposed because the resource is no longer valid. When I commit my changes I would expect any input that I opened from that commit to close (e.g. diff editors). Not sure though if this is a concept we need to add as API to extensions or rather the SCM viewlet being the one that closes any editor opened as soon as there are no more outgoing changes in a group. Since for example the |
FYI: I use an auto markdown preview extension which had a similar problem. Closing the source document that the preview pane is created and synchronized with doesn't close the corresponding preview. Additionally, opening multiple documents can sometimes mess up or shuffle tabs around. I'm not sure if it's relevant but it may be helpful to keep that in mind so that other developers are able to handle these problems more easily too. hnw/vscode-auto-open-markdown-preview#2 |
Is there any progress on this? New user to VSCode and it's a little annoying and weird that I have to close these all the time. Even if it wasn't automatic I would love even just a |
To me at the very least it would seem appropriate to have all "working tree" editors grouped in their own tree in the explorer pane, possibly with an option to hide that tree entirely unless you are in the "Source Control" view. This would greatly reduce the clutter and grunt-work of closing those editors all the time. |
Also, its bizarre discarding changes made by my cat's paws on the keyboard from the night before, and still seeing the changes in the document after going to Source control pane and Discarding Changes on that file. Obviously the problem here is the cat trying to code and not knowing basic syntax and grammar, however, the Discard Changes feature I would intuitively expect it to also revert the changes in the opened document tab (or ask to revert?) Instead the changes are still visible in the document tab, even though the underlying file has been reverted. And, you could end up with an unintended Close-All,Theres-Modified-Files-Not-Saved type scenario that could possibly reintroduce "speculative code" within files, and need to Discard Changes yet again on that file. |
I hate to be that guy, but any news? |
Still looking for something on this. Anything new? |
Love VSCode, this is my biggest gripe though. Workflow of double checking changes, before committing is made...... painful because of the lack of any way to close all working tree files. |
I got the same idea: there should be an option to close all diff tabs when going out of source control mode |
Or close all diff views on commit |
This issue would have been resolved with what was discussed in #85237: Adding a setting to always open working tree files in preview mode the issue got closed by vscodebot though, so... whatever |
Still would support this feature, but as a workaround I've stopped using the built-in git integration. Works great! |
Right, but that issue's title is incomprehensible... @phil294 what do you use instead? |
edamagit rules!! 👍 |
@joaomoreno I hate to (also) be that guy, but this issue has been hanging around for far too long (4+ years). Can we get some traction on at least a path forward with some options? Honestly at this point I'd be happy with a setting that would simply hide any working tree editors unless you are in the source control view. It just makes no sense whatsoever to have to manually close a working tree editor in the explorer view, and I haven't seen any reason presented why anyone would actually want the current behavior. |
Thanks for the diplomatic answer Joao, can we do anything on our side to speed up #15178? Thanks! |
Thanks @joaomoreno. I do want to clarify that I'm really not trying to be critical of vscode overall. I love the app and appreciate all the amazing work that has been done these last many years by you and other developers. This is just one of those things that I deal with literally every day so I would hope it would be taken off the backburner. This is really the only thing that truly bugs me about using vscode. If I could contribute anything useful towards a resolution I'd certainly offer my limited skillset as well. |
Adding another voice to this. Does it really need to be so complicated? It seems like a lot of time has been spent thinking about the context in which to show the diff editor, intelligently closing it etc. It doesn't have to be smart. Literally just something in the command palette that will close any tabs with EDIT: I had a go at building an extension to achieve this and ended up down a rabbit hole. Looks like there is a bunch of work being done at the moment exploring how to work with open tabs programatically. If the resulting API changes include a |
Today's Insiders release (2022-02-10) contains a new setting ( |
@lszomoru that's a good first step, but it would also be great if diff windows were limited to the "Source Control" tab? |
@lszomoru I agree with @taiya |
Today's Insider build (2022-02-16) also contains a new command, As for the request for the diff editors to only show when the SCM viewlet is active, I am most certain that its not currently possible. There is currently no support to associate an editor with a particular viewlet so that it is only being shown when the viewlet is active. This in scope is also greater than just SCM - imagine that you open the Extensions viewlet, search for an extension, and you click on it to show its details. It would be nice if the extension details editor would only show when the Extensions viewlet is active. I have filed a separate issue to track adding support for associating an editor with a viewlet. |
I am going to close this issue for now, while the concept of associating an editor with a viewlet is being discussed in the linked issue. If you are passionate about that, please add your feedback to that issue. In case there is a positive resolution of that issue, we can adopt that capability for the diff editors. |
Just a note that the newer related issue #143193 is now officially a candidate for the backlog of feature implementations, but it needs 20 upvotes to pass the threshold. Please head over there and upvote if you haven't already. |
I am seeing multiple editors in index and working tree hanging around even though those are no longer valid:
The text was updated successfully, but these errors were encountered: