Skip to content

fix(tui): hint mention depth cap on misses#2530

Draft
cyq1017 wants to merge 2 commits into
Hmbown:mainfrom
cyq1017:codex/2488-mention-depth-hint
Draft

fix(tui): hint mention depth cap on misses#2530
cyq1017 wants to merge 2 commits into
Hmbown:mainfrom
cyq1017:codex/2488-mention-depth-hint

Conversation

@cyq1017
Copy link
Copy Markdown
Contributor

@cyq1017 cyq1017 commented Jun 1, 2026

Summary

  • add a status hint when path-like @-mention completion misses under a nonzero walk depth
  • keep ordinary filename misses unchanged
  • keep the default walk depth and completion behavior unchanged

Refs #2488

Verification

  • cargo test -p codewhale-tui try_autocomplete_file_mention_no_match --locked
  • cargo fmt --all -- --check
  • git diff --check

Greptile Summary

This PR refines the @-mention autocomplete miss experience by showing a contextual depth-limit hint only when the typed path is plausibly too deep for the current mention_walk_depth setting.

  • Adds no_file_mention_matches_status and path_partial_reaches_walk_depth helpers to file_mention.rs; the hint fires only when the component count of the partial is at or above walk_depth, and is suppressed entirely when walk_depth == 0 (unlimited).
  • Adds three targeted tests: deep-path hint fires, shallow-path hint suppressed, and unlimited-depth hint suppressed — the last of which directly covers the previously-flagged missing negative case.

Confidence Score: 5/5

The change is narrowly scoped to status-message text generation and has no effect on autocomplete logic, file I/O, or app state beyond status_message.

Both helpers are pure functions with no side effects. The guard for walk_depth == 0 and the component-count comparison are straightforward. Previous review feedback (depth-component counting and the missing unlimited-depth negative test) has been fully addressed. The three new tests cover all meaningful branches.

No files require special attention.

Important Files Changed

Filename Overview
crates/tui/src/tui/file_mention.rs Extracts status-message logic into two well-scoped private helpers; handles walk_depth==0, cross-platform path separators, and empty components correctly.
crates/tui/src/tui/ui/tests.rs Adds three new unit tests covering the positive case (hint fires for deep partial), negative case (shallow partial, no hint), and unlimited-depth case (walk_depth=0, no hint).

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[try_autocomplete_file_mention] --> B{candidates empty?}
    B -- Yes --> C[no_file_mention_matches_status\npartial, walk_depth]
    C --> D{path_partial_reaches_walk_depth?}
    D -- walk_depth == 0 --> E["No files match @{partial}"]
    D -- component_count < walk_depth --> E
    D -- component_count >= walk_depth --> F["No files match @{partial}\n(mention_walk_depth=N; use /config set\nmention_walk_depth 0 to search deeper)"]
    B -- No, single match --> G[replace + attach]
    B -- No, multiple --> H{shared prefix longer?}
    H -- Yes --> I[extend partial]
    H -- No --> J[show top 5 candidates]
Loading

Reviews (2): Last reviewed commit: "fix(tui): narrow mention depth hint" | Re-trigger Greptile

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

Comment thread crates/tui/src/tui/file_mention.rs Outdated
Comment thread crates/tui/src/tui/ui/tests.rs
@Hmbown
Copy link
Copy Markdown
Owner

Hmbown commented Jun 1, 2026

Harvested into #2504 for the v0.8.50 release slice.

What landed:

  • a97675824 / 29f57665e add the targeted mention_walk_depth status hint for deep path-like @ misses while keeping autocomplete behavior unchanged.

Local verification on the harvest branch:

  • cargo test -p codewhale-tui --all-features --locked try_autocomplete_file_mention_no_match -- --nocapture
  • cargo clippy -p codewhale-tui --all-targets --all-features --locked -- -D warnings
  • ./scripts/release/check-versions.sh

Live #2504 CI is green across Ubuntu, macOS, Windows, lint, version drift, CodeQL, mobile smoke, npm smoke, and GitGuardian. Thanks @cyq1017; I kept your authorship on the harvested commits.

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.

2 participants