-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Description
The method syntax.Node.Span uses binary search to convert a file offset into a line number.
Location heavy tools, like our language server or formatter, would benefit from line-caches. For example like so:
func (t *tree) position(pos int) Position {
if t.cachedLineBegin <= pos && pos < t.cachedLineEnd {
line = t.cachedLine
}
// ...
}To be efficient we probably need two separate line-caches, one for n.Pos() and one for n.End(). Best would be creating benchmarks comparing random position access, accessing only begin-offsets and accessing whole spans (begin- and end-offset).
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers