feat(tui): file selection mentions with frecency ranking
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 19.9k
- Forks
- 2.3k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 30
Description
Feature: File Selection Mentions in TUI Composer
Reason
When composing prompts in the jcode TUI, there is no way to quickly reference files by name. Users have to manually type full file paths, which is error-prone and slow, especially in large codebases. This feature adds an autocomplete-style file mention system (similar to @file mentions in editors and chat apps) so users can quickly insert file references into their prompts.
What was done
Implemented file selection mentions in the TUI composer with the following commits:
-
feat(tui): add file selection mentions— Core feature: typing@in the composer triggers a file mention popup. Files are indexed from the working directory (respecting.gitignoreand common ignore patterns). New modules:file_mention.rs(~1900 lines) — file index, fuzzy matching, and mention popup logicchar_bag.rs— compact character-bag fuzzy matching helperstate_ui_input_helpers.rs— input state helpers for mention navigation
-
fix(tui): preserve chat selection across composer drags— Ensures the chat view selection is not lost when dragging/resizing the composer, which previously caused mention state corruption. -
fix(tui): harden file mention index and path matching— Hardened the file index against race conditions (files changing during indexing) and improved path matching accuracy (case-insensitive, partial path segments). -
feat(tui): rank file mentions by frecency— Added frecency (frequency + recency) ranking so recently and frequently opened files appear first in the mention popup. Introduced aFrecencyEntrystruct to track access patterns.
Files changed (15 files, +3808 / -986 lines)
Key new files:
crates/jcode-tui/src/tui/app/file_mention.rs— main mention logiccrates/jcode-tui/src/tui/app/char_bag.rs— fuzzy matchingcrates/jcode-tui/src/tui/app/state_ui_input_helpers.rs— UI helpers
Modified files:
crates/jcode-tui/src/tui/app/input.rs—@trigger handlingcrates/jcode-tui/src/tui/ui_input.rs— popup rendering and key handlingcrates/jcode-tui/src/tui/app/tui_lifecycle.rs,tui_state.rs,mod.rs— wiring
Branch
The full implementation is available on my fork:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the implementation on the select_files branch and the listed files under crates/jcode-tui/src/tui/app/, starting with file_mention.rs and input.rs. Check how the popup, fuzzy matching, indexing, path handling, and frecency ranking are wired through ui_input.rs and the lifecycle files; done means the complete feature is integrated and behaves as described in the TUI.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 20/100