refactor: Restructure file search settings
This commit restructures the file search settings. The previously individual settings for file search method, regex search backend, match search backend, and ripgrep path have been grouped into a new filesSearchSettings object.
This commit is contained in:
@@ -611,7 +611,7 @@ const Chat = forwardRef<ChatRef, ChatProps>((props, ref) => {
|
||||
}
|
||||
}
|
||||
} else if (toolArgs.type === 'match_search_files') {
|
||||
const searchBackend = settings.matchSearchBackend
|
||||
const searchBackend = settings.filesSearchSettings.matchBackend
|
||||
let results: string;
|
||||
if (searchBackend === 'omnisearch') {
|
||||
results = await matchSearchUsingOmnisearch(toolArgs.query, app)
|
||||
@@ -633,7 +633,7 @@ const Chat = forwardRef<ChatRef, ChatProps>((props, ref) => {
|
||||
}
|
||||
}
|
||||
} else if (toolArgs.type === 'regex_search_files') {
|
||||
const searchBackend = settings.regexSearchBackend
|
||||
const searchBackend = settings.filesSearchSettings.regexBackend
|
||||
let results: string;
|
||||
if (searchBackend === 'coreplugin') {
|
||||
results = await regexSearchUsingCorePlugin(toolArgs.regex, app)
|
||||
@@ -641,7 +641,7 @@ const Chat = forwardRef<ChatRef, ChatProps>((props, ref) => {
|
||||
// @ts-expect-error Obsidian API type mismatch
|
||||
const baseVaultPath = String(app.vault.adapter.getBasePath())
|
||||
const absolutePath = path.join(baseVaultPath, toolArgs.filepath)
|
||||
const ripgrepPath = settings.ripgrepPath
|
||||
const ripgrepPath = settings.filesSearchSettings.ripgrepPath
|
||||
results = await regexSearchUsingRipgrep(absolutePath, toolArgs.regex, ripgrepPath)
|
||||
}
|
||||
const formattedContent = `[regex_search_files for '${toolArgs.filepath}'] Result:\n${results}\n`;
|
||||
|
||||
Reference in New Issue
Block a user