-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix: prevent negative line index when maxReadFileLine is zero #1910
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
Conversation
When maxReadFileLine setting was set to zero, the code would attempt to read lines with a negative end index (maxReadFileLine - 1 = -1), causing the readLines function to reject the request. This change: - Checks if maxReadFileLine is greater than zero before calling readLines - Returns an empty string when maxReadFileLine is zero - Ensures content is only formatted with line numbers when it's not empty Signed-off-by: Eric Wheeler <[email protected]>
|
Hmmm, what does it even mean to have a max of 0 for this? We might want to have a floor for this setting, like 100 lines. |
It means read_file only shows declaration content and then it uses start/end_line to load only what it needs for incredibly small context. give it a try, it works quite well |
Ah interesting, I see what you mean. I wonder if we need to change the copy around the setting then to make it more clear that it’s not a hard max, it’s just the default chunk size. Separate from this PR. |
|
good idea |
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
|
|
Merged in #1915. Thanks! |
Context
Fixed an issue where the read_file tool would fail when maxReadFileLine=0, as the code attempted to access a negative line index.
Implementation
Added checks to:
Before
After
works :)
How to Test
Get in Touch
Discord: KJ7LNW
Important
Fixes negative line index error in
Cline.tsforread_filetool whenmaxReadFileLine=0.Cline.tswhereread_filetool fails withmaxReadFileLine=0by preventing negative line index access.readLinesifmaxReadFileLine > 0.maxReadFileLine = 0.Cline.tsto include conditional logic aroundreadLinescall andcontentassignment.This description was created by
for fc82873. It will automatically update as commits are pushed.