feat: flatten single-child dirs in file explorer (#14173)

This commit is contained in:
Sylvain Terrien
2025-09-22 15:32:27 +02:00
committed by GitHub
parent 8acfc55280
commit 55167c21df
4 changed files with 80 additions and 20 deletions

View File

@@ -221,7 +221,7 @@ impl Default for FilePickerConfig {
}
}
#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case", default, deny_unknown_fields)]
pub struct FileExplorerConfig {
/// IgnoreOptions
@@ -229,22 +229,39 @@ pub struct FileExplorerConfig {
/// Whether to hide hidden files in file explorer and global search results. Defaults to false.
pub hidden: bool,
/// Enables following symlinks.
/// Whether to follow symbolic links in file picker and file or directory completions. Defaults to true.
/// Whether to follow symbolic links in file picker and file or directory completions. Defaults to false.
pub follow_symlinks: bool,
/// Enables reading ignore files from parent directories. Defaults to true.
/// Enables reading ignore files from parent directories. Defaults to false.
pub parents: bool,
/// Enables reading `.ignore` files.
/// Whether to hide files listed in .ignore in file picker and global search results. Defaults to true.
/// Whether to hide files listed in .ignore in file picker and global search results. Defaults to false.
pub ignore: bool,
/// Enables reading `.gitignore` files.
/// Whether to hide files listed in .gitignore in file picker and global search results. Defaults to true.
/// Whether to hide files listed in .gitignore in file picker and global search results. Defaults to false.
pub git_ignore: bool,
/// Enables reading global .gitignore, whose path is specified in git's config: `core.excludefile` option.
/// Whether to hide files listed in global .gitignore in file picker and global search results. Defaults to true.
/// Whether to hide files listed in global .gitignore in file picker and global search results. Defaults to false.
pub git_global: bool,
/// Enables reading `.git/info/exclude` files.
/// Whether to hide files listed in .git/info/exclude in file picker and global search results. Defaults to true.
/// Whether to hide files listed in .git/info/exclude in file picker and global search results. Defaults to false.
pub git_exclude: bool,
/// Whether to flatten single-child directories in file explorer. Defaults to true.
pub flatten_dirs: bool,
}
impl Default for FileExplorerConfig {
fn default() -> Self {
Self {
hidden: false,
follow_symlinks: false,
parents: false,
ignore: false,
git_ignore: false,
git_global: false,
git_exclude: false,
flatten_dirs: true,
}
}
}
fn serialize_alphabet<S>(alphabet: &[char], serializer: S) -> Result<S::Ok, S::Error>