-
Notifications
You must be signed in to change notification settings - Fork 1.3k
CLI - Local file suggestion with @ #3491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: 5d5cbf1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds file mention autocomplete functionality that allows users to reference files using @ mentions with fuzzy search and autocomplete support. The feature integrates with the existing autocomplete system and respects .gitignore patterns.
Key changes:
- Implemented a new
FileSearchServicewith caching, fuzzy search, and gitignore support - Extended the autocomplete system to detect and handle file mentions (text starting with
@) - Updated UI components to display file mention suggestions with file/folder icons
- Added comprehensive test coverage for file search and mention detection
Reviewed Changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| cli/src/services/fileSearch.ts | New service providing file search with caching and gitignore filtering |
| cli/src/services/autocomplete.ts | Added file mention detection and suggestion generation |
| cli/src/state/hooks/useCommandInput.ts | Integrated file mention context detection and cursor tracking |
| cli/src/state/atoms/ui.ts | Added atoms for file mention suggestions and context state |
| cli/src/state/atoms/keyboard.ts | Updated keyboard handling for file mention autocomplete and ESC behavior |
| cli/src/ui/components/CommandInput.tsx | Added file mention suggestions to the autocomplete flow |
| cli/src/ui/components/AutocompleteMenu.tsx | Added UI rendering for file mention suggestions |
| cli/src/state/atoms/tests/keyboard.test.ts | Added tests for file mention ESC key behavior |
| cli/src/services/tests/fileSearch.test.ts | Tests for file search service core functionality |
| cli/src/services/tests/fileSearch.gitignore.test.ts | Tests for gitignore filtering |
| cli/src/services/tests/autocomplete.file-mention.test.ts | Tests for file mention detection and suggestions |
| cli/package.json | Added fast-glob dependency |
| pnpm-lock.yaml | Updated lockfile with new dependencies |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (2)
cli/src/services/tests/fileSearch.test.ts:1
- This new test file is missing the
// kilocode_change - new filecomment at the top as required by the coding guidelines for Kilocode-specific files.
/**
cli/src/state/hooks/useCommandInput.ts:1
- These new lines are missing
// kilocode_changemarkers as required by the coding guidelines since they are additions to an existing file.
/**
| * @param maxResults Maximum number of results to return (default: 50) | ||
| * @returns Array of matching file search results | ||
| */ | ||
| async searchFiles(query: string, cwd: string, maxResults = 50): Promise<FileSearchResult[]> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can cache this, as well as the loadGitIgnore, I think? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's cached by the getAllFiles, the loadGitIgnore is a private function only used by the getAllFiles when is not cached.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about caching searchFiles, or do you not think that's needed? 🤔
355d995 to
5d5cbf1
Compare
Context
Resolve #3244
Implementation
Screenshots
How to Test
@on any part of the text to initialize the suggestion.