[PR #6705] fix(ui): use full file path for fuzzy matching in autocomplete #12053

Closed
opened 2026-02-16 18:16:59 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/6705

State: closed
Merged: Yes


Summary

Fixes #7388

  • Fix file search in @ autocomplete to match against full file paths instead of truncated display strings
  • Fix MCP resources search to match against full resource text instead of truncated display strings

Problem

When attaching files or MCP resources using @ in the TUI, long paths/URIs are truncated with "…" in the middle for display (e.g., src/components/f…ationService.ts). The fuzzy search was running against this truncated string, so typing text that was hidden by the ellipsis would fail to find matches.
This affected both:

  1. Files - long file paths were truncated
  2. MCP Resources - long resource names/URIs were truncated

Solution

Added a value field to AutocompleteOption that preserves the full text for fuzzy matching, while display continues to show the truncated version. The fuzzy filter now uses value when available, falling back to display for backward compatibility.

Changes

  • Added value?: string to AutocompleteOption type
  • Set value to full filename when creating file options
  • Set value to full resource text when creating MCP resource options
  • Updated fuzzy matching to use value ?? display
  • Added tests for file autocomplete filtering logic
  • Added tests for MCP resource autocomplete filtering logic

Demo

Screen Recording 2026-01-02 at 23 13 36

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/6705 **State:** closed **Merged:** Yes --- ### Summary Fixes #7388 - Fix file search in `@` autocomplete to match against full file paths instead of truncated display strings - Fix MCP resources search to match against full resource text instead of truncated display strings ### Problem When attaching files or MCP resources using `@` in the TUI, long paths/URIs are truncated with "…" in the middle for display (e.g., `src/components/f…ationService.ts`). The fuzzy search was running against this truncated string, so typing text that was hidden by the ellipsis would fail to find matches. This affected both: 1. **Files** - long file paths were truncated 2. **MCP Resources** - long resource names/URIs were truncated ### Solution Added a `value` field to `AutocompleteOption` that preserves the full text for fuzzy matching, while `display` continues to show the truncated version. The fuzzy filter now uses `value` when available, falling back to `display` for backward compatibility. ### Changes - Added `value?: string` to `AutocompleteOption` type - Set `value` to full filename when creating file options - Set `value` to full resource text when creating MCP resource options - Updated fuzzy matching to use `value ?? display` - Added tests for file autocomplete filtering logic - Added tests for MCP resource autocomplete filtering logic ## Demo ![Screen Recording 2026-01-02 at 23 13 36](https://github.com/user-attachments/assets/d421fef3-9e9d-4bbc-80ab-22f38ae1b765)
yindo added the pull-request label 2026-02-16 18:16:59 -05:00
yindo closed this issue 2026-02-16 18:16:59 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12053