Skip to content

fix: keep the selected file suggestion visible - #1448

Closed
RealBhupesh wants to merge 2 commits into
Nano-Collective:mainfrom
RealBhupesh:fix/file-completion-window
Closed

RealBhupesh wants to merge 2 commits into
Nano-Collective:mainfrom
RealBhupesh:fix/file-completion-window

Conversation

@RealBhupesh

Copy link
Copy Markdown
Contributor

Fixes #1405.

File autocomplete always rendered fileCompletions.slice(0, 5) and compared the highlight to that slice index. Moving past the fifth suggestion hid the selection, so Tab could insert a path that was not on screen. The list now windows around the selected index, the same way command completions already do.

Test plan

  • completion-window.spec.ts

Made with Cursor

File autocomplete always rendered the first five matches, so a selection
past that page lost its highlight and Tab could insert an unseen path.

Fixes Nano-Collective#1405
@github-actions

Copy link
Copy Markdown
Contributor

No changeset found

This PR does not add a changeset, so it will not appear in the changelog or trigger a release.

If the change is user-facing, add one:

pnpm changeset

Pick a bump (patch / minor / major) and write the changelog entry in our usual voice ("Added X... Thanks to @you. Closes #123."), then commit the generated .changeset/*.md file.

If this PR is docs-only or a chore that needs no release note, you can ignore this — or run pnpm changeset --empty to record that intentionally.

@github-actions

Copy link
Copy Markdown
Contributor

nc-review: comments — 1 important, 3 nits

@RealBhupesh — a few things worth a look, none blocking.

The fix correctly resolves the highlight-vanishing bug by replacing the hard-coded fileCompletions.slice(0, 5) render with a windowed view centered on the selected index, reusing the same algorithm that already drives the slash-command list. The Tab path at line 515 was already reading fileCompletions[selectedFileIndex]?.path, so it is now consistent with what is on screen. Two small follow-ups are worth raising before merging: the file list lacks the 'Showing X-Y of Z' indicator the slash-command list has, and the new window size is the literal 5 instead of a named constant. A changeset also appears to be missing for a user-facing fix.

🟠 important · changeset · .changeset

This is a user-visible bug fix in the TUI: previously, pressing Down past the fifth file match and then Tab would insert a path that was never rendered, which is observable and surprising. A .changeset/*.md describing the patch under the nanocoder (or relevant workspace) package name should accompany the PR. The project rubric explicitly calls out that the package name must resolve against the workspace, and that a missing changeset on a user-facing change is the kind of thing the release pipeline silently drops.

⚪ nit · completeness · source/components/user-input.tsx:1269

The slash-command completion list at the same site shows a Showing X-Y of Z indicator when the list is longer than the window (see the block immediately above this hunk). The file-completion list now also windows around the selection, but it never tells the user that scrolling happened, which is exactly the affordance that lets users understand the highlight has moved off-page. Mirroring the same indicator would close the loop the issue described.

⚪ nit · design · source/components/user-input.tsx:1136

The new fileCompletionWindow uses the literal 5 for the window size, while the sibling command-completion block a few lines above uses the named constant MAX_COMMAND_COMPLETION_ROWS = 10. Introducing MAX_FILE_COMPLETION_ROWS = 5 (or similar) keeps the two completion surfaces in lock-step and makes the choice of window size grep-able, which matters because the file path of the bug was a hard-coded slice in this exact spot.

⚪ nit · tests · source/components/completion-window.spec.ts

The new spec covers the extracted helper correctly and would fail if the centering regression returned. The follow-on concern is that user-input.tsx itself still has no test exercising the render of the file-completion list, so the contract between selectedFileIndex and the rendered highlight (the actual bug site) is only covered indirectly. This is not blocking — the helper is the right unit — but worth noting that a regression at the call site would not be caught by these tests alone.


🔴 blocking · 🟠 a reviewer would ask for a change · ⚪ optional

Automated code review — correctness, security, design, tests, plus duplicates and scope. A human still decides; this is not a substitute for review and is not exhaustive. The required status checks separately cover lint, formatting, types, unused dependencies, the test suite and the build. This bot never merges. Maintainers can rerun with /re-review.

@github-actions github-actions Bot added the agent:comments nc-review left non-blocking findings label Sep 23, 2026
Biome rejected the object-literal spacing in the new window helper.
@will-lamerton

Copy link
Copy Markdown
Member

Thanks for this, @RealBhupesh, and sorry it sat so long. #1405 was already fixed on main by #1426 (09d820db), and the list now lives in composer/file-mention-list.tsx with the same windowing approach, so this change no longer applies. Closing as superseded. If you'd like to pick up another issue, ask to be assigned first so work isn't duplicated.

@RealBhupesh

Copy link
Copy Markdown
Contributor Author

Thanks @will-lamerton, understood. Glad #1405 got fixed via #1426. I'll ask to be assigned first before picking up anything new.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent:comments nc-review left non-blocking findings area:tui Terminal UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] @file mention autocomplete highlight vanishes past the 5th item, so Tab can insert a file that was never shown

2 participants