Skip to content

[Enhancement] Display Ignored Directories with Marker in File Tree#28

Merged
kasperjunge merged 1 commit intomainfrom
exlude-ignored-dirs-in-file-tree
Feb 27, 2025
Merged

[Enhancement] Display Ignored Directories with Marker in File Tree#28
kasperjunge merged 1 commit intomainfrom
exlude-ignored-dirs-in-file-tree

Conversation

@kasperjunge
Copy link
Copy Markdown
Owner

This PR updates the FileTreeGenerator to improve the clarity of the generated context report. The changes include:

  • New Behavior for Ignored Directories:
    When a directory is excluded via .copconignore or .copcontarget, its name is still shown in the file tree. However, instead of recursing into its children, the directory is displayed with a trailing slash and the marker (contents not displayed). This clearly indicates that the directory exists but its contents were intentionally omitted.

  • Implementation Details:

    • In copcon/core/file_tree.py, the generate() method was updated to check for ignored directories. If a directory is determined to be ignored (via the file filter), its entry is appended with the marker, and no recursion is performed into that directory.
    • The directory and file counts are maintained appropriately.
  • Tests Updated:
    A new test in tests/test_file_tree.py verifies that:

    • Ignored directories (e.g., node_modules) are displayed with the correct marker.
    • The children of ignored directories are not listed.
    • The overall directory and file counts match the expected values.

This enhancement helps users understand the structure of their project while clearly indicating which directories were filtered out.

Looking forward to your feedback!

@kasperjunge kasperjunge merged commit 620aee1 into main Feb 27, 2025
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant