-
Notifications
You must be signed in to change notification settings - Fork 175
Rename line_to_byte_offset -> byte_offset #3877
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
Conversation
Also, include the column in here. Hopefully we can do some additional optimizations later.
eregon
left a comment
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.
LGTM
What are you thinking to? That method looks already pretty much optimal, it's basically just an |
| offsets[find_line(byte_offset) + 1] || source.bytesize | ||
| end | ||
|
|
||
| # Return the column number for the given byte offset. |
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.
| # Return the column in bytes for the given byte offset. |
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.
In general I think we should avoid the term column number, at least I would interpret that as starting at 1 like an editor column. So I'd suggest to use column in bytes/characters/code units.
Happy to make a PR for that if you agree.
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.
Sure yeah, happy to see that 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.
Not sure. Since we have both operands, we could potentially cache based on both. I'm not sure if it would be worth it, but I wanted to have both. |
Also, include the column in here. Hopefully we can do some additional optimizations later.