Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 30 additions & 14 deletions src/crates/services/services-core/src/filesystem/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,22 +108,15 @@ impl Default for FileTreeOptions {
fn default() -> Self {
Self {
max_depth: Some(50),
include_hidden: false,
include_hidden: true,
include_git_info: false,
include_mime_types: false,
skip_patterns: vec![
"node_modules".to_string(),
"target".to_string(),
".git".to_string(),
"dist".to_string(),
"build".to_string(),
".next".to_string(),
".nuxt".to_string(),
".cache".to_string(),
"coverage".to_string(),
"__pycache__".to_string(),
".vscode".to_string(),
".idea".to_string(),
".svn".to_string(),
".hg".to_string(),
".DS_Store".to_string(),
"Thumbs.db".to_string(),
],
max_file_size_mb: Some(100),
follow_symlinks: false,
Expand Down Expand Up @@ -776,8 +769,7 @@ impl FileTreeService {
}

fn should_skip_file(&self, file_name: &str) -> bool {
// Skip hidden files and directories (unless explicitly included)
// But .gitignore and .bitfun are always shown
// Skip hidden files and directories unless explicitly included.
if !self.options.include_hidden
&& file_name.starts_with('.')
&& file_name != ".gitignore"
Expand Down Expand Up @@ -1596,6 +1588,30 @@ pub enum SearchMatchType {
mod tests {
use super::*;

#[test]
fn default_tree_visibility_matches_vscode_baseline() {
let service = FileTreeService::default();

for name in [".git", ".svn", ".hg", ".DS_Store", "Thumbs.db"] {
assert!(service.should_skip_file(name), "{name} should be excluded");
}

for name in [
".env",
".github",
".vscode",
"node_modules",
"target",
"dist",
"build",
] {
assert!(
!service.should_skip_file(name),
"{name} should be visible by default"
);
}
}

#[tokio::test]
async fn content_search_preserves_matching_lines_and_preview_ranges() {
let root = tempfile::tempdir().expect("create temp search directory");
Expand Down
2 changes: 1 addition & 1 deletion src/web-ui/src/app/components/panels/FilesPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ const FilesPanel: React.FC<FilesPanelProps> = ({
rootPath: workspacePath,
autoLoad: true,
enablePathCompression: true,
showHiddenFiles: false,
showHiddenFiles: true,
// Local filesystem watchers are unavailable for remote SSH workspaces.
enableAutoWatch: !isRemoteCurrentWorkspace,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export class ExplorerController {
autoLoad: true,
enableAutoWatch: true,
enablePathCompression: true,
showHiddenFiles: false,
showHiddenFiles: true,
sortBy: 'name',
sortOrder: 'asc',
excludePatterns: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const EMPTY_SNAPSHOT: ExplorerSnapshot = {
loadingPaths: new Set(),
options: {
enablePathCompression: true,
showHiddenFiles: false,
showHiddenFiles: true,
sortBy: 'name',
sortOrder: 'asc',
excludePatterns: [],
Expand Down
2 changes: 1 addition & 1 deletion src/web-ui/src/tools/file-explorer/model/ExplorerModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { ExplorerControllerConfig, ExplorerNodeRecord, ExplorerSnapshot } f

const DEFAULT_OPTIONS: FileSystemOptions = {
enablePathCompression: true,
showHiddenFiles: false,
showHiddenFiles: true,
sortBy: 'name',
sortOrder: 'asc',
maxDepth: undefined,
Expand Down
Loading