Skip to content

fix(tui): sort directory completions first for quoted values - #1649

Closed
yuzhiyang1 wants to merge 2 commits into
PrimeIntellect-ai:mainfrom
yuzhiyang1:fix/autocomplete-directory-sorting
Closed

fix(tui): sort directory completions first for quoted values#1649
yuzhiyang1 wants to merge 2 commits into
PrimeIntellect-ai:mainfrom
yuzhiyang1:fix/autocomplete-directory-sorting

Conversation

@yuzhiyang1

@yuzhiyang1 yuzhiyang1 commented Aug 22, 2026

Copy link
Copy Markdown

The path-completion sort in packages/tui/src/autocomplete.ts decided "is a directory" via suggestion.value.endsWith("/"). When the completion value is quoted (paths with spaces, or @"..." prefixes), buildCompletionValue returns e.g. @"dir/" — which ends with ", not / — so aIsDir was always false and the directory-first ordering silently did nothing for quoted completions.

Sort on label instead (which is name + "/" for directories), matching how the rest of the file treats labels.

Note

Fix directory completion sorting for quoted values and edit-diff occurrence counting

  • Fix autocomplete directory-first sorting by checking the suggestion label's trailing slash instead of the value's, since quoted values may not end with a slash. See autocomplete.ts.
  • Fix countOccurrences in edit-diff.ts to count literal occurrences and return 0 for empty oldText, instead of counting splits.
  • Fix applyEditsToNormalizedContent to count occurrences in the same normalization space as the successful match: exact matches stay unique even if fuzzy normalization would create extra occurrences; fuzzy matches enforce uniqueness in the normalized space.
  • Risk: countOccurrences no longer uses fuzzy normalization when counting; callers relying on normalized counting behavior will get literal counts instead.

Macroscope summarized 60e4a1e.

@github-actions

Copy link
Copy Markdown

Hi @yuzhiyang1, thanks for your interest in contributing!

This project requires that pull request authors are vouched, and you are not in the list of vouched users.

This PR will be closed automatically. See https://github.com/PrimeIntellect-ai/prime-agent/blob/main/CONTRIBUTING.md for more details.

@github-actions github-actions Bot closed this Aug 22, 2026
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.

1 participant