-
Notifications
You must be signed in to change notification settings - Fork 365
Update editors when containing directory is renamed or removed (redux) #1049
Conversation
…view into mkt-events-and-editor-updates
How does another package respond to these callbacks? It'd seem that an entirely different |
They wouldn't; this is just an implementation detail. Other packages would consume the top-level API. [Edit] To be clear, I meant that we don't rely on the dialog's emitter; the callbacks supplied still call |
Oh, sorry... I misinterpreted completely. 👍 In which case, looks good to me! |
@disposables.add @onEntryDeleted ({path}) -> | ||
for editor in atom.workspace.getTextEditors() | ||
if editor?.getPath()?.startsWith(path) | ||
editor.destroy() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe not destroy them if they have unsaved changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, this code path didn't change (it was only moved). I'll double check again but I was pretty sure that it left the editor open with unsaved changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, you're right - it definitely does get destroyed. Sounds like a bug to me! I'll check for another issue and if one doesn't exist, create one. Thanks.
This is another pass at #1044, but basing the work on @Alhadis' changes at #966 (which fit in perfectly with this feature). See the former PR for more details on the feature.
Katrina and I are moving on to other projects, but since we didn't get to this in the past week, I wanted to take care of it now.
@Alhadis, I pulled in the changes from your PR and made some changes on top. Namely:
CopyDialog
andMoveDialog
now take callbacks instead of relying on the emitter directlyinitialPath
andnewPath
, and if there is only one it's alwayspath
Let me know if that causes any conern for you, and thank you so much for your work on this!
Closes #1044
Closes #966
Fixes #948
Fixes atom/tabs#12
Fixes atom/tabs#413
Fixes atom/atom#9875
/cc @kuychaco