-
Notifications
You must be signed in to change notification settings - Fork 366
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
Edit: display warning for large @-mentions #3767
Conversation
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'm concerned about the scalability of this approach. Because stat is cheap but tokenization is not. Once we move to token counting this may need to be very different.
So let's stop investing more in synchronous size checks, until we work out how to scale to (more) accurate token counting. Some ideas:
- Have a fast path for files which are definitely small enough, or definitely too large (for example, work out the smallest/largest byte -> token count expansion ahead of time and do a quick file size check to exclude tokenizing the largest files)
- Cache the token counts
- Do the token counts lazily, prioritizing items the user has already selected (which means we need to show errors after the user has chosen something) or that are visible in the quickpick (can we get what's visible from the VSCode QuickPick?)
- Get a smarter tokenizer, for example if we can stream, we could stop tokenizing as soon as we know something is too large
This is a follow-up on #3619 (comment) |
Makes sense. It threw me for a loop in the context of this token counting change. |
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.
Nice!
The changes in this pull request address an issue where the total size of selected context items could exceed the character budget for the active model when importing through @-mentions.
The Edit Command Menu has been updated to:
Additionally, the
filterLargeFiles
function ineditor-context.ts
has been updated to store the file size in theContextItemFile
object, which is used in thegetInput
function to determine if a file is too large.These changes help ensure that the user is not presented with context items that would cause the input to exceed the character limit, providing a better user experience and preventing potential issues with the editor's functionality.
Test plan
Follow-up