Range positions (-Yrangepos) will be on by default in 2.13.4

This change is now merged and is included in currently nightlies. (link: how to use a Scala nightly)

What are range positions? References: Scaladoc, reflection doc

Eugene Yokota’s PR flipped the switch, but it was possible to do so after years of bugfixes and performance improvements to range positions made by assorted people.

Metals (and other semanticdb-based tooling) requires range positions, so lots of people have already had them enabled in their daily work. That, and a green community build run, gives us reasonable confidence that they are robust and fast enough to be enabled by default.

Regardless, posting this here hoping folks will test a nightly, especially tooling authors who think they change might impact them.


So how come they were able to work without this change (Metals, and others)?

I don’t know all the details, but the Metals documentation says:

setting up Metals requires a few manual steps to generate Bloop JSON files. In addition to normal Bloop installation, Metals requires that the project sources are compiled with the semanticdb-scalac compiler plugin and -Yrangepos option enabled.

Perhaps someone else will follow up with more info.

-Yrangepos are added by Bloop to the scalac options if the client is detected to be Metals. It’s the same with semanticdb options.


The short answer is that the flag was turned on either manually (see Scalafix) or automatically (see @tgodzik’s answer for how Metals and Bloop does it).

Having this on by default will greatly simplify those workflows, which is great news!

1 Like

So theoretically, if a project was somehow sensitive to the rangepos flag, then it would have worked differently in Metals and as a standalone executable, right?

Yes, it could work differently, but in reality we never found it to be a problem. And this would be possible to happen only when compiled with Bloop.

1 Like