Skip to content
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

Improve dynamic context building for multi-diff hunks #1549

Open
lwsli opened this issue Feb 18, 2025 · 1 comment
Open

Improve dynamic context building for multi-diff hunks #1549

lwsli opened this issue Feb 18, 2025 · 1 comment
Labels

Comments

@lwsli
Copy link

lwsli commented Feb 18, 2025

Feature request

Proposed Improvements

  1. Merge Multiple Changes within Same Function

Proposed Implementation:

  • Detect multiple diff segments within the same function
  • Merge them into a unified change block
  • Fetch the complete function context only once
  • Reduce redundant context retrieval operations
  1. Extend Context Retrieval Direction

Proposed Implementation:

  • Maintain existing upward retrieval to function start
  • Add support for downward retrieval to function end
  • Provide complete function-level context
  • Ensure suggestion accuracy and completeness

Motivation

Current Limitations

  1. Redundancy with Multiple Changes

Currently, when multiple changes exist within a single function, each diff segment triggers a separate fetch of the entire function content
This leads to unnecessary context duplication and performance overhead
2. Context Retrieval Direction Limitation

The current implementation only supports retrieving context upward to the function's start position
Lacks the ability to fetch context downward to the function's end
May result in incomplete context and potentially affect suggestion accuracy

@lwsli lwsli added the feature 💡 label Feb 18, 2025
@mrT23
Copy link
Collaborator

mrT23 commented Feb 21, 2025

Thanks for the suggestion @lwsli

Your proposal has potential, but it's quite complicated to implement.

let's start from this:

The current implementation only supports retrieving context upward to the function's start position
Lacks the ability to fetch context downward to the function's end

How do you propose to do this ?
We currently search upward using github mechanism that tells you (sometimes) what is the function header.
How do you suggest methodically searching downward (in any programming language)?

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants