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

Truncate left and right file contents for suggestions requests #77

Merged
merged 2 commits into from
Nov 15, 2023

Conversation

rtarcr
Copy link
Contributor

@rtarcr rtarcr commented Nov 15, 2023

Problem

When working on large files and left or right contents of the file are larger than 10240 characters, the request fails with a validation error.

Solution

Truncate the contents of the file to the left and right of the cursor

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@rahmaniaam
Copy link
Contributor

Would be good to double check if the limitation is solely on character size rather than on byte size, since some characters might be 2 bytes instead of 1

@rtarcr
Copy link
Contributor Author

rtarcr commented Nov 15, 2023

Would be good to double check if the limitation is solely on character size rather than on byte size, since some characters might be 2 bytes instead of 1

Based on my testing and on VSCode implementation (https://github.com/aws/aws-toolkit-vscode/blob/master/src/codewhisperer/util/editorContext.ts#L28-L33), it is done on character basis

@rtarcr rtarcr merged commit 8e65463 into main Nov 15, 2023
@rtarcr rtarcr deleted the truncate-contents branch November 15, 2023 17:26
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.

2 participants