-
Notifications
You must be signed in to change notification settings - Fork 25
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
Fix code block token count #153
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #153 +/- ##
==========================================
+ Coverage 90.64% 90.75% +0.10%
==========================================
Files 11 11
Lines 2373 2400 +27
Branches 2373 2400 +27
==========================================
+ Hits 2151 2178 +27
Misses 159 159
Partials 63 63 ☔ View full report in Codecov by Sentry. |
i18n-helpers/src/lib.rs
Outdated
@@ -569,12 +569,22 @@ fn check_code_block_token_count(group: &[(usize, Event)]) -> usize { | |||
let events = group.iter().map(|(_, event)| event); | |||
let mut in_codeblock = false; | |||
let mut max_token_count = 0; | |||
|
|||
// token_count should be taken over Text events | |||
// because a continuous text may be splitted to some Text events. |
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.
Nit: If this is about splitting a single text into several Text
events, then several
instead of some
might be more accurate in this context.
4f3b869
to
dbff4ca
Compare
@kdarkhan Thank you for your review. I've fixed the comment and |
Thanks, looks good! |
This PR fixes wrong token count in code block reported at #150.