feat(tui): add interactive file type filtering via T key#493
Merged
dundee merged 2 commits intodundee:masterfrom Feb 25, 2026
Merged
feat(tui): add interactive file type filtering via T key#493dundee merged 2 commits intodundee:masterfrom
dundee merged 2 commits intodundee:masterfrom
Conversation
Add the ability to filter items by file extension interactively in the TUI, similar to the existing name filter (/ key). Press T to open a type filter input where comma-separated extensions can be entered (e.g. go,yaml,json). Filtering is real-time and directories always pass through since they are navigational containers. Both name and type filters can be active simultaneously with AND logic. The footer shows the active type filter, and TAB cycles focus between any open filter inputs and the table. Filters are cleared on directory navigation, consistent with the existing name filter behavior. Refactored footer management into rebuildFooter() to support multiple coexisting filter inputs cleanly. Closes dundee#473
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #493 +/- ##
==========================================
+ Coverage 81.42% 81.66% +0.23%
==========================================
Files 49 49
Lines 5126 5197 +71
==========================================
+ Hits 4174 4244 +70
- Misses 816 817 +1
Partials 136 136 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
Author
|
Added follow-up tests to address the Codecov patch gap in tui/filter.go.
Local verification after this commit:
Please let CI/Codecov refresh on latest head 818e9e0. |
dundee
approved these changes
Feb 25, 2026
Owner
|
Nice PR, thank you! |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds interactive file type filtering to the TUI, addressing #486. Press
Tto open a type filter input in the footer where comma-separated file extensions can be entered (e.g.go,yaml,json). This mirrors the existing name filter (/key) interaction pattern.What changed
tui/filter.go: AddedshowTypeFilterInput(),hideTypeFilterInput(),matchesTypeFilter(), andrebuildFooter(). Refactored existing name filter methods to userebuildFooter()for clean coexistence of both inputs. Added"Name: "label prefix to the existing name filter input for clarity.tui/show.go: Added type filter check inshowDir()rendering loop (directories always pass through, files filtered by extension). AddedTto help text. Added active type filter display in footer. ExtractedformatTypeFilterInfo()to keepshowDir()within cyclomatic complexity limits.tui/keys.go: AddedTkeybinding inhandleMainActions(). UpdatedhandleFiltering()to support TAB cycling for both filter inputs. Updated the filtering guard to check both filter states.tui/tui.go: AddedtypeFilterValue,typeFiltering,typeFilteringInputfields. UpdatedfileItemSelected()to clear type filter on directory navigation.Behavior
Tgo,yaml.goand.yamlfiles shown, all directories remain visibleESCEnterTAB/andTactiveExtensions are case-insensitive, leading dots optional (both
goand.gowork), files without extensions are hidden when a type filter is active.Tests
Added 7 new test functions in
tui/filter_test.go:TestTypeFiltering— core filtering with single and multi-type valuesTestTypeFilteringWithoutCurrentDir— guard against nil currentDirTestTypeFilteringKeyBinding—Tkey activates the filterTestExitTypeFiltering— ESC clears filter stateTestTypeFilterTabSwitch— TAB focus cyclingTestBothFiltersCoexist— name + type filters applied simultaneouslyTestMatchesTypeFilter— unit tests for extension matching (case, dots, empty, dirs)All existing tests pass.
golangci-lintclean. Race detector clean.Closes #486