oyvindberg / bleep

A bleeping fast scala build tool!
MIT License
145 stars 21 forks source link

Build error/warning line numbers are one-too-low #416

Open dwalend opened 1 month ago

dwalend commented 1 month ago

When I run bleep compile on a simple project all the error and warning line numbers are one-too-low.

For example:

blart

package submerged

Should be complaining about line 1, but references a line 0:

$ bleep compile Submerged
📗 Launching Bleep version 0.0.3 as requested in /Users/dwalend/projects/scala-ev3/firefly-coders-ev3dev/bleep.yaml
📗 bootstrapped in 35 ms
📕 BSP: Submerged expected class or object definition [value => file:///Users/dwalend/projects/scala-ev3/firefly-coders-ev3dev/Submerged/src/scala/submerged/Menu.scala:0:0 until 0:0]
📕 BSP: Submerged '{' expected. [value => file:///Users/dwalend/projects/scala-ev3/firefly-coders-ev3dev/Submerged/src/scala/submerged/Menu.scala:4:0 until 4:0]
📕 command failed: compile Submerged failed status code ERROR
✘-1 ~/projects/scala-ev3/firefly-coders-ev3dev [Submerged|✚ 2…11] 

Is there some setting in the bleep.yaml I need to set? Or is this a bug from bloop or scalac ?

oyvindberg commented 4 weeks ago

I have seen this as well. honestly I don't know, it seems to be correct in IDEs through BSP.

can you test newest 0.0.7 (once I manage to get it to sonatype) and newest scala and see if it's fixed?

dwalend commented 4 weeks ago

can you test newest 0.0.7 (once I manage to get it to sonatype) and newest scala and see if it's fixed?

I'm glad to try it, but if you're seeing the same problem then I'm not sure what value I can add.

Does bleep post-process the errors from the compiler or just show each line raw? It could be the IDE support is adding one to the line number. I looked through some of the bleep code but didn't spot it. (It seems unlikely someone would subtract 1 from the line number before printing it out.)

oyvindberg commented 3 weeks ago

so this info comes directly from bloop, you can find the thin bleep presentation layer in BspClientDisplayProgress.

I briefly checked newest bleep and scala-cli with an illegal file, and scala-cli seems to get the position in the file right. I wonder if they patch the information from bloop or what's going on there

dwalend commented 3 weeks ago

I briefly checked newest bleep and scala-cli with an illegal file, and scala-cli seems to get the position in the file right. I wonder if they patch the information from bloop or what's going on there

Do you know the right people working on bloop or scala-cli well enough to ask that indelicate question?

sideeffffect commented 3 weeks ago

@tgodzik could know :pray:

oyvindberg commented 3 weeks ago

It's pretty easy to dig up in the scala-cli source actually. It seems like they do a lot of translation - I'll link it when I'm on a computer

tgodzik commented 2 weeks ago

Both LSP and BSP are 0-based, which is why it works in Metals. The editor just translates it to actual line numbers.