-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat read file range #1440
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
feat read file range #1440
Conversation
|
f4d064a to
673f11b
Compare
|
Instead of adding a new tool and having the LLM choose between them, should we just add optional start/end line to the |
ok, i will update pr with that approach |
6171fc4 to
afbc064
Compare
|
@mrubens updated ! :D |
fc86b8f to
2008a5e
Compare
|
Nice! How does it feel? |
|
@mrubens it's work perfectly :D current test with file 333M (2000000 line) from https://www.datablist.com/learn/csv/download-sample-csv-files, and it work ok, i think we can support mention read file in range with syntax like "@test.log::{10,100}"
|
2008a5e to
d50f41c
Compare
|
A couple thoughts on this:
What do you think? |
|
I guess not exactly the same approach, but this is what I'm thinking of: https://github.com/ccrvlh/codey/blob/f823be88322b7417d75c4db98a0cc224de6ad97b/src/core/tools.ts#L306-L341 |
|
|
Great! Maybe we can reuse what that list_code_definitions tool does somehow? |
yes, but the tool use processing is hard to maintain now, we need to separate into another module to easy maintain later |
src/core/webview/ClineProvider.ts
Outdated
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.
I think the default should be 500
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.
Er, let's wait to make a call - but 4500 feels huge
I think so? But maybe we would actually want to support start_line=-100 for this (100 from the end)? |
|
this approach would allow multiple ranges, slicing: also see my related comment here: #1374 (comment)
I like that notation too, perhaps: |
@KJ7LNW sound good idea @mrubens should we allow read multiple file but limit their range ? |
what do you mean by "allow read multiple file" ?
hard-coded limits are a bad idea. let the AI choose, or create a config option for limits |
in single request and response allow user can read multiple file
No we have setting, and already have that in this PR, you can check it |
|
I like the ideas of the support for tailing and multiple file reads, but I think those can be follow-ups - there's already a lot in this PR. |
00332e4 to
890f237
Compare
|
it looks like this PR picked up a huge number of changes that are not related to this feature. can you rebase on be sure to backup your work first:
|
Already rebase on main, you can check the git commit |
that looks much better thank you! |
890f237 to
d0143c9
Compare
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
c27b6e4 to
3e1f7b6
Compare
|
Going to run this as my editor today and see how it goes! |
I am curious how the AI utilizes the file ranges! |
|
@samhvw8 looking at the exports of my chats, I don't think it's currently appending the definitions to the tool result when the read is truncated. |
Let me find a way to truncate more 💪🏻 |
Oh I think I was confused! |

Context
There is many case that user want Roo read sample of file or read file in range of line
Implementation
Screenshots
How to Test
Get in Touch
Important
Adds
read_file_rangetool to read specific line ranges from files, with updated tool descriptions and tests.read_file_rangetool toClineclass inCline.tsfor reading specific line ranges from files.toolUseNamesandtoolParamNamesinindex.tsto includeread_file_range.getReadFileRangeDescription()inread-file-range.tsfor tool description.readLines()innthline.test.tsto validate line range reading, including edge cases like negative and non-integer line numbers.readLines()function innthline.tsto read specified line ranges from files.TOOL_DISPLAY_NAMESandTOOL_GROUPSintool-groups.tsto includeread_file_range.This description was created by
for 9099f87199323125e269c58b2289adde4e74a771. It will automatically update as commits are pushed.