This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Repository navigation
Conversation
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

There's currently no reliable way to detect when a user's renamed or moved a file in the tree-view. Filesystem events such as
did-destroyare by no means fit for detecting a file's deletion; such events are also triggered onFileobjects when draggingFileViewobjects between folders.Furthermore, it's difficult to determine a file or directory's previous path when responding to a path change. Short of individually monitoring every file and directory's status, package authors have no easy way to respond to user-directed changes in the filesystem.
This PR addresses this matter by introducing a number of events that're emitted at certain points in the
tree-view's lifecycle:directory-createdpath: Resolved/normalised path of the directoryentry-copiedoldPath: Path to source file/directorynewPath: Path of newly-created file/directoryentry-deletedpath: Last-known path of a deleted resourceentry-moved: Self-explanatory. Invoked by both cut-and-paste as well as drag-and-drop/rename.oldPathnewPathfile-createdpath: Resolved/normalised path of the fileThese events are emitted on the main
tree-viewinstance, which is accessible through both the DOM as well as viaatom.packages.activePackages["tree-view"].mainModule.treeView.