Sorry I glossed over this before and totally forgot to circle back around. So my implementation in here under the hood ends up relying on Spans which are actually end-exclusive as you can see in this little example:
//> using scala 3.3.0
//> using lib org.scala-lang::scala3-compiler:3.3.0
import dotty.tools.dotc.util.Spans.Span
@main def test() =
val span = Span(3, 7)
println(span.start)
println("---------")
println(span.end)
println("---------")
val range = span.start until span.end
for (i <- range)
println(i)
Which prints out
3
---------
7
---------
3
4
5
6
The reason I went with that is because at least in Scala 3 the Span
is also what is used in that same way for the rewrite functionality and I didn’t want to change the semantics between when they were used via the IDE and when they were used when rewriting with the compiler. Plus, this way ends up being a bit easier to simply translate to the LSP range without having to worry about that difference.
In Scala 2 with yours being end inclusive, is there a reason you went that route?