Skip to content

prompt improvement: get 100 buffer lines above and below instead of whole file - #159

Merged
ThePrimeagen merged 1 commit into
ThePrimeagen:masterfrom
ataha322:ata/contrib
May 2, 2026
Merged

prompt improvement: get 100 buffer lines above and below instead of whole file#159
ThePrimeagen merged 1 commit into
ThePrimeagen:masterfrom
ataha322:ata/contrib

Conversation

@ataha322

@ataha322 ataha322 commented Mar 16, 2026

Copy link
Copy Markdown
Contributor

Note

Low Risk
Low risk: only changes prompt context generation for visual selections by limiting included buffer text, with minimal impact beyond prompt contents and potential off-by-one range edge cases.

Overview
Updates the visual_selection prompt to embed only nearby buffer context (100 lines above/below the selection) instead of dumping the entire file.

Adds get_surrounding_context(range, n) to compute the bounded slice of buffer lines used in the prompt, reducing prompt size and improving relevance.

Written by Cursor Bugbot for commit e939b97. This will update automatically on new commits. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment thread lua/99/prompt-settings.lua
Comment thread lua/99/prompt-settings.lua
@cursor

cursor Bot commented Mar 16, 2026

Copy link
Copy Markdown

You have used all of your free Bugbot PR reviews.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@ThePrimeagen ThePrimeagen left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix pweeze

Comment thread lua/99/prompt-settings.lua Outdated
@ilyaZar

ilyaZar commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

wouldnt this compute from = start_row - 100 which becomes negative when the visual selection is near the top of a file

iam not a pro but I think its worht checking if nvim treats negative nvim_buf_get_lines() indexes as relative tod the end of the buffer not as "clamp to line 1" ; so top-of-file selections in larger files can return unrelated middle/end slices or {} instead of the intended surrounding context

see #171 fro my try to rework this a bit

@ThePrimeagen
ThePrimeagen merged commit 3bc191f into ThePrimeagen:master May 2, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants