Skip to content

Commit d2b591b

Browse files
committed
Remove unnecessary article from README tip and simplify file search logic by removing progress tracking
1 parent 956d8d9 commit d2b591b

2 files changed

Lines changed: 2 additions & 23 deletions

File tree

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Code Web Chat is an open-source and privacy-first **AI coding toolkit for VS Cod
3535
<p align="center"><img src="https://github.com/robertpiosik/CodeWebChat/raw/HEAD/packages/shared/src/media/screenshot-3.png"></p>
3636

3737
> [!TIP]
38-
> Use a built-in [API tool](#built-in-api-tools) _Edit Context_ to make multi-file edits directly from the editor.
38+
> Use [a built-in API tool](#built-in-api-tools) _Edit Context_ to make multi-file edits directly from the editor.
3939
4040
## Enabling autofill
4141

‎apps/editor/src/commands/search-files-for-context.ts‎

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -340,39 +340,24 @@ export const search_files_for_context_command = (
340340
const search_files_by_keywords = async (params: {
341341
files: string[]
342342
search_term: string
343-
progress?: vscode.Progress<{ message?: string; increment?: number }>
344-
token?: vscode.CancellationToken
345343
}): Promise<string[]> => {
346344
const matched_files: string[] = []
347-
const total = params.files.length
348-
let processed = 0
349-
const increment = total > 0 ? (1 / total) * 100 : 0
350345

351-
// Escape special characters and treat multiple spaces as flexible whitespace
352346
const escaped_term = params.search_term.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
353347
const pattern = escaped_term.replace(/\s+/g, '\\s+')
354-
const regex = new RegExp(pattern, 'mi') // Case-insensitive, multiline
348+
const regex = new RegExp(pattern, 'mi')
355349

356350
for (const file_path of params.files) {
357-
if (params.token?.isCancellationRequested) break
358-
359351
try {
360352
const file_name = path.basename(file_path)
361353

362-
// Check filename first
363354
if (regex.test(file_name)) {
364355
matched_files.push(file_path)
365356
continue
366357
}
367358

368-
// Skip large files (> 1MB) to avoid performance issues
369359
const stats = await fs.promises.stat(file_path)
370360
if (stats.size > 1024 * 1024) {
371-
processed++
372-
params.progress?.report({
373-
increment,
374-
message: `${processed}/${total}`
375-
})
376361
continue
377362
}
378363

@@ -384,12 +369,6 @@ const search_files_by_keywords = async (params: {
384369
} catch (error) {
385370
// Ignore read errors (binary files, permissions, etc.)
386371
}
387-
388-
processed++
389-
params.progress?.report({
390-
increment,
391-
message: `${processed}/${total}`
392-
})
393372
}
394373

395374
return matched_files

0 commit comments

Comments
 (0)