project_panel: Add Alt/Opt+Click
to expand/collapse a directory and all its contents
#22896
+633
−13
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.
Closes #15966
This PR adds
Alt/Opt+Click
to expand or collapse a directory and all its contents.Context:
The current
expand_entry
scans immediate child subdirectories if they aren’t loaded, whileexpand_all_for_entry
scans the entire subtree. The latter takes longer, so we wait for it to complete to ensure accurate results.For full directory scan, instead of using
refresh_entries_for_paths(vec![path])
, which requires specifying all explicit paths to refresh, we useadd_path_prefix_to_scan
, which eliminates the need to list every path. Both methods internally callreload_entries_for_paths
, which invokesshould_scan_directory
. This determines whether to scan deeper based on a path prefix match between the given directory and its subdirectories, returningtrue
foradd_path_prefix_to_scan
.The existing code handles scanning, removing path prefixes after scans complete, and managing ignored directories.
How it works (Expand):
node_modules
,dist
, etc or git submodules, when you expand any root dir.In example,
draft
andposts
dir are ignored dir.expand-1.webm
node_modules
,dist
, etc.In example,
dist
dir is ignored dir.expand-2.webm
expand-3.webm
How it works (Collapse):
Alt clicking any opened directory will collapse it and all its children, whether ignored or not. This is when you want to start from a fresh state.
When auto fold is enabled in settings, collapse action will also fold all subdirectories that it can fold. This is to bring it back to its fresh state as mentioned above.
collapse-1-2.webm
Future:
Todos:
Release Notes: