-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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 an option to disable closing open files that are removed from the directory #11642
Comments
If we do this I will get the exact opposite bug that users complain a tab is not closed when a file is deleted :) |
could you implement it as a setting that can be overridden at the user/workspace settings? |
+1 This feature in Sublime text has saved my ass once or twice when I've accidentally deleted a file I was using. VS Code's auto-save feature comes close to this, but doesn't deliver the same functionality as Sublime. While an auto-saved file stays open after the file has been deleted, when you change tabs the contents disappears and an error is displayed. |
Adding more than a 👍, because I feel this issue deserves reconsideration, and I have a proposal to reconciliate @bpasero's point of view with our pain. First, to synthesize:
In Sublime/Atom, the editor tab status communicates the file is dirty, but as soon as the file is back and in the same state as initially, the dirty tab flag disappears and I can keep on hacking on Proposal
What do you think? |
I looked into this and I am hitting an issue that is kind of blocking. First of all, what other editors seem to do is:
My idea was to introduce a new setting
Now this works fine up to a certain point: imagine you have 2 tabs open Interestingly ST seems to have solved this, I can only imagine that tabs which are open are loaded from disk into memory (which is ugly). Not sure what to do for this case, it is also ugly to close tabs that are not loaded. |
Btw for those people that randomly see tabs closing even though the file is still there, please see #13665 (comment) for helping me out finding the underlying issue. |
I pushed a change to introduce a new setting "
There are some underlying implications as well in this state:
This needs some good testing, so feedback welcome (will be in tomorrows insider build). |
Reopening based on some feedback from the team which I want to capture here (without opinion):
|
By the way, Atom 1.15 is at it too:
|
One of the main concerns we have to solve is if marking such a deleted file as dirty is a good decision. It may draw the wrong impression to the user because so far we only show the dirty indicator when changes have been made by the user. Happy to hear thoughts from people subscribed to this issue on that topic. |
Personally, I've seen the functionality being discussed here in other IDEs and have grown accustomed to it. With that said, given such scenario, if vs code does a Save As when the user tries to save the file (because it's marked dirty), it isn't really a drawback or inconvenience in my opinion. And I can safely assume the majority of the community using vs code is rather tech savvy and would know what's going on. |
After lots of feedback from the team and discussion, we settled on a solution that does NOT mark the editor as dirty but just indicate to the user that the file has been deleted on disk: Marking the file as dirty has some consequences that we are worried about:
Imho this setting should eventually be the new default, but I want to give it some more testing and feedback. The setting is now called: |
The main scenario here is when the user switches git branches where the starting branch has a file that the branch being switched to does not. What I'm seeing is the file in question is removed from the open editor. I would like for that file to remain open, just unsaved. Similar to how Sublime handles it.
might be similar to issue #101
steps to reproduce:
expected behavior:
file remains open in editor unsaved.
actual behavior:
file is removed from the editor.
The text was updated successfully, but these errors were encountered: