feat: calculate real-time directory size in spotter#2695
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR implements a real-time directory size calculation feature in the spotter, including dynamic updates and cancellation of ongoing calculations.
- Integrates asynchronous size calculation and cancellation in the spotter workflow.
- Extends data structures and bindings to support a new Urn type with serialization and error handling.
- Updates related files (FilesOp, update_spotted, and update_size) to incorporate the new functionality.
Reviewed Changes
Copilot reviewed 16 out of 18 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| yazi-shared/src/url/urn.rs | Added Serialize derive to UrnBuf for better integration. |
| yazi-shared/src/event/data.rs | Updated Data and DataKey enums to include the new Urn variant. |
| yazi-plugin/src/utils/spot.rs | Added a new id field to SpotLock and updated conversion logic. |
| yazi-plugin/src/isolate/spot.rs | Introduced a static Ids generator for job creation. |
| yazi-plugin/src/fs/op.rs | Added support for a new "size" FilesOp using Urn as a key. |
| yazi-fs/src/files.rs | Modified update_size with filtering logic using a threshold. |
| yazi-dds/src/sendable.rs | Extended Sendable conversions to include Urn support. |
| yazi-core/src/tab/commands/update_spotted.rs | Updated spotted handling to use new reset logic. |
| yazi-core/src/spot/spot.rs | Added a reset method that aborts ongoing tasks and updates UI. |
| yazi-core/src/spot/commands/close.rs | Simplified close command by invoking the new reset method. |
| yazi-core/src/mgr/commands/update_mimes.rs | Minor improvements in error handling while parsing options. |
| yazi-binding/src/urn.rs | Introduced a new Urn binding with FromLua and UserData trait. |
| yazi-binding/src/url.rs | Modified Url struct & caching to support the new Urn field. |
| yazi-binding/src/lib.rs | Updated module inclusion to add the Urn module. |
Files not reviewed (2)
- yazi-plugin/preset/plugins/folder.lua: Language not supported
- yazi-plugin/preset/ya.lua: Language not supported
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.
Follow up to #2683, #2691
An implementation of the feature request: #842, #2649
Closes #842
Closes #2649
This PR adds directory sizes to the
folderspotter, the size is computed dynamically in real time and asynchronously, which means:<Tab>on a directory, the latest size is calculated.Also, the computed directory size will be updated to the file list:
linemode = size, the latest size will be shown on the right of the file line.sort_by = size, the file list will be sorted with the latest sizes (if necessary).screenshot-002318.mp4