semantic icon indicating copy to clipboard operation
semantic copied to clipboard

1-indexed Spans are fiddly

Open robrix opened this issue 6 years ago • 0 comments

Pos is 1-indexed, which means so is Span, which is fiddly:

  • we have to increment the line & col we get from tree-sitter
  • any time we’re using them for actual computation (e.g. slicing up source) we have to decrement them appropriately
  • but then be careful not to use the decremented values in another Span without re-incrementing
  • and so on

I think we should make all of this 0-indexed, and only convert to 1-indexed when we’re showing stuff to the user (e.g. in error messages, hyperlinks, etc).

robrix avatar Sep 19 '19 20:09 robrix