mirror of
https://github.com/EthanMarti/infio-copilot.git
synced 2026-05-10 09:07:47 +00:00
refactor: Improve file search tool descriptions and reliability
- Updates the description for the regex_search_files tool to dynamically indicate the regex syntax used based on the user's settings (ECMAScript or Rust). - Refactors the core plugin match search to wait for the search view to load before attempting to access results, addressing a timing issue. - Adds new settings for regexSearchBackend and matchSearchBackend in settings.test.ts to reflect the refactored backend options for file searching.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { ToolArgs } from "./types"
|
||||
import { useSettings } from '../../../contexts/SettingsContext'
|
||||
|
||||
export function getSearchFilesDescription(args: ToolArgs): string {
|
||||
if (args.searchTool === 'match') {
|
||||
@@ -17,7 +18,7 @@ export function getMatchSearchFilesDescription(args: ToolArgs): string {
|
||||
Description: Request to perform a match/fuzzy search across files in a specified directory, providing context-rich results. This tool searches for specific content across multiple files, displaying each match with encapsulating context.
|
||||
Parameters:
|
||||
- path: (required) The path of the directory to search in (relative to the current working directory ${args.cwd}). This directory will be recursively searched.
|
||||
- query: (required) The keyword, phrase to search for. The system will find documents with similar keywords/phrases.
|
||||
- query: (required) The keyword/phrase to search for. The system will find documents with similar keywords/phrases.
|
||||
|
||||
Usage:
|
||||
<match_search_files>
|
||||
@@ -33,11 +34,24 @@ Example: Requesting to search for all Markdown files containing 'test' in the cu
|
||||
}
|
||||
|
||||
export function getRegexSearchFilesDescription(args: ToolArgs): string {
|
||||
const { settings } = useSettings()
|
||||
let regex_syntax: string;
|
||||
switch (settings.regexSearchBackend) {
|
||||
case 'coreplugin':
|
||||
regex_syntax = "ECMAScript (JavaScript)";
|
||||
break;
|
||||
case 'ripgrep':
|
||||
regex_syntax = "Rust";
|
||||
break;
|
||||
default:
|
||||
regex_syntax = "ECMAScript (JavaScript)";
|
||||
}
|
||||
|
||||
return `## regex_search_files
|
||||
Description: Request to perform a regex search across files in a specified directory, providing context-rich results. This tool searches for patterns or specific content across multiple files, displaying each match with encapsulating context.
|
||||
Parameters:
|
||||
- path: (required) The path of the directory to search in (relative to the current working directory ${args.cwd}). This directory will be recursively searched.
|
||||
- regex: (required) The regular expression pattern to search for. Uses Rust regex syntax, **but should not include word boundaries (\b)**.
|
||||
- regex: (required) The regular expression pattern to search for. Uses ${regex_syntax} regex syntax, **but should not include word boundaries (\b)**.
|
||||
|
||||
Usage:
|
||||
<regex_search_files>
|
||||
|
||||
Reference in New Issue
Block a user