Repository navigation
Commit directory references when accepting @ completions - #766
Open
baixinghao wants to merge 1 commit into
Open
baixinghao wants to merge 1 commit into
baixinghao wants to merge 1 commit into
Conversation
Accepting a directory completion in the @ picker only inserted the trailing slash, which immediately re-opened completion on the directory's children and made it impossible to reference the directory itself. Accepting a directory now moves past (or inserts) a separating space so the @ token is committed and the picker closes; typing a path by hand still completes into the directory's children. Fixes huggingface#464.
This branch has not been deployed
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
The
@picker listed directories with a trailing slash, but accepting one only replaced the token with@dir/, which immediately re-triggered completion on the directory's children. There was no way to commit a directory itself as a reference — users were forced to drill in and pick a file.Accepting a directory completion now commits the reference: the caret moves past (or inserts) a separating space after
@dir/, leaving the@token so the picker closes instead of re-opening on children. This implements the "trailing space" option proposed in the issue discussion. Drilling into a directory still works by typing its path — every keystroke re-narrows the flat, recursive suggestion list.Fixes #464.
Changes
src/tau_coding/tui/app.py—action_accept_completion: when the accepted completion is aFILE_REFERENCEending with/(a directory), reuse an existing following whitespace character or insert a space, and place the caret after it. File completions, shell-path completions (!cat …), and all picker-screen accept dispatch are unchanged.tests/test_tui_app.py— three new regression tests (see below).website/content/guides/tui.md— the "Referencing files with@" section now documents that directories are shown with a trailing/and that inserting one commits it as a directory reference.Tests
New tests in
tests/test_tui_app.py(Textualrun_test+FakeSession, matching neighboring completion tests):test_tui_app_accepts_directory_reference_completion— Tab on@src/commitsinspect @src/, closes the picker, and deleting the space re-opens child completion (drill-in by typing still works).test_tui_app_accepts_directory_reference_before_existing_space— mid-text accept reuses the existing following space instead of doubling it, and parks the caret after it.test_tui_app_submits_committed_directory_reference— Tab then Enter submitsinspect @src/to the session end to end.Verification
main(assert 'inspect @src/' == 'inspect @src/ '), then pass with the fix.uv run pytest tests/test_tui_autocomplete.py tests/test_commands.py— 88 passed.uv run pytest tests/test_tui_app.py -k "completion or mention or footer_hints or directory_reference or file_reference or shell_path"— 31 passed.tests/test_tui_app.pyon this branch: 15 failed / 438 passed; on the stashed clean baseline: 13 failed / 437 passed. The differing tests (test_session_sidebar_lists_active_system_prompt_files, two login-picker tests) fail or pass flakily on both revisions and in isolation, and are unrelated to completion handling (sidebar rendering, login picker timing); the 12 remaining failures are identical pre-existing Windows failures on both revisions.uv run ruff check/uv run ruff format --checkon the changed files — clean;uv run mypy src/tau_coding/tui/app.py— no issues.prettier --check content/guides/tui.md— clean.Notes for reviewers
@dir/into the directory's contents at submit time. Tau currently does not expand@references at all (the path is sent as prompt text and the agent uses its tools), so there is no resolver to extend; this PR is scoped to the picker. If inline directory expansion is wanted later, it can be built separately.@loginstill findssrc/components/auth/login.pydirectly, and typing a directory prefix by hand still lists its children.