Fixes#6756
When ripgrep encounters file access errors (e.g., permission denied), it would cause the search_files tool to return empty results. Adding the --no-messages flag suppresses these error messages while still showing pattern syntax errors, allowing the search to continue and return valid results from accessible files.
Co-authored-by: Roo Code <roomote@roocode.com>
Problem:
- Previous implementation incorrectly grouped context lines with matches
- Context lines were split into beforeContext/afterContext arrays, making it difficult to maintain proper line order
- Output format was inconsistent with read_file output
- Non-contiguous search results were sometimes broken or incorrectly grouped
- Example of incorrect output:
# bench/bundle-test/rollup.config.mjs
16 | file: 'dist/index-wasm.min.mjs',
17 | format: 'es',
24 | output: {
----
25 | file: 'dist/index-lite.min.mjs',
26 | format: 'es',
----
# packages/rehype/package.json
----
10 | it('run', async () => {
27 | "files": [
28 | "dist"
----
Solution:
- Replace separate context arrays with a single 'lines' array containing both matches and context
- Add isMatch flag to distinguish between match and context lines
- Improve contiguity detection by checking if line numbers are sequential
- Standardize output format to match read_file output
- Properly handle non-contiguous search results by creating new result groups
- Example of correct output:
# bench/bundle-test/rollup.config.mjs
16 | file: 'dist/index-wasm.min.mjs',
17 | format: 'es',
----
24 | output: {
25 | file: 'dist/index-lite.min.mjs',
26 | format: 'es',
----
This change ensures search results are properly grouped and displayed with the correct context.
Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Co-authored-by: Eric Wheeler <roo-code@z.ewheeler.org>
* feat read file range
feat: add file truncation with code structure preview
Add configurable line limit for large file handling with source code structure preview. This improves performance and memory usage while maintaining code readability.
Key changes:
Add maxReadFileLine setting (default: 4500) with UI controls
Create efficient line counter utility using streams
Add parseSourceCodeDefinitionsForFile for single file parsing
Show truncation notice with code structure for large files
Add comprehensive tests for new functionality
Move file extensions to shared constant
add line number
pr comment
Return definition ranges from tree-sitter
make treesitter always add line
add line number to rg search
enhance tree siter output & fix test
update snapshot
fix test
* Add translations, tweak range
---------
Co-authored-by: Matt Rubens <mrubens@users.noreply.github.com>
* Chore: Pretier for consistant formatting
- TODO: This PR needs to be updated by Saoud after he runs `npm install` & `npm format:fix` and commits the results of the prettier changes.
* Revert prettier config
* Run npm install
* Fix prettier config and ignore package lock
* Run format
---------
Co-authored-by: Saoud Rizwan <7799382+saoudrizwan@users.noreply.github.com>