Enhance deleted state#13
Conversation
05aa611 to
27f0b26
Compare
|
#11 landed, so this can come out of draft. I'm not aiming for 1.132 on this one; probably 1.133 if the first phase (conflict detection) goes smoothly. So this isn't urgent! |
27f0b26 to
3d2e1b0
Compare
Would this be configurable with the old behaviour? Or at least are we able to add some kind of confirm step options or warning here like a "this file has been deleted - close buffer?" prompt? My thinking here is that sometimes I end up with a deleted file that is still open in a buffer but I don't actually realise it has been deleted, so that prompt at the very least makes me think "why would this be asking me to save a modified file?". That pause has saved me from deleting data more than a few times - especially when viewing things like log files that might rotate. Edit: Just tried it out:
The "modified" state is no longer triggered so it doesn't prompt you to save the file or anything, it just closes if you close it. It looks the same as a saved file. Do we have a follow up change in the main repo to actually "do" anything with this new state? And are there any core packages that rely on the old behaviour somehow that would be affected by this? What about community packages? Do we need to be able to fall back somehow? |
Yes — we've got a setting for the related behavior added in 1.132.0 (prompt on “conflicted” state) so we'd add a setting for this behavior as well.
Yes (EDIT: such a PR will exist after this one lands). Aside from actually adding the setting, we'll also want to modify the
I cannot think of any. When I added the (Actually, since this will be governed by a setting on the Pulsar side, I'll do some testing to make sure I can preserve the existing behavior when that setting is unchecked.) |
Probably not the place for it as outside of the scope of this PR if we are making these further changes but we would need to decide on what takes priority in this case - are we checking the state based on the VCS or this? (if you have And the same for tree-view in theory. |
For As for The screenshots I showed you are just my proof-of-concept on my own custom UI theme. We'll want to add some sort of cosmetic treatment to the built-in UI themes; I haven't tried that yet, but I imagine it'll be similar to what VS Code does. (I know they do the red-plus-strikethrough treatment for deleted files, but am not 100% sure of how they depict conflicted files.) Fair point about the |
|
In which case, whilst I can't comment on the code itself, the change does do what it advertises from my quick testing, and so long as we have the necessary config changes and other PRs to go with this when we bump this in the main repo, then I don't have any objections. |
|
Yeah, I'll bump the version on |
Issue or RFC Endorsed by Atom's Maintainers
#12
Description of the Change
This improves handling of a “deleted” buffer state as follows:
isDeletedis now a state that can be queried just likeisModifiedorisInConflict.isModifiedso that it no longer automatically returnstrueif the buffer's file doesn't exist. Instead, it returnsfalseif the buffer was unmodified at time of deletion, as long as no subsequent edits have been made. Otherwise, it returnstruein all scenarios in which it would've previously returnedtrue.This allows us to get closer to VS Code's behavior with deleted files: allow the user to remove their tab (representing a file that was deleted) from the workspace without an unnecessary “are you sure?” prompt.
Alternate Designs
#12 outlines the two possible designs. I went with the first one because it's more elegant.
Possible Drawbacks
There could be unintended side effects of narrowing the definition of
isModifiedfor one specific kind of pane item. I haven't found any yet, but we should keep an eye on this.Verification Process
New unit tests.
Release Notes