propensive / fury-old

A new build tool for JVM languages
Apache License 2.0
413 stars 34 forks source link

error highlighting of symbols is unreliable #1053

Open propensive opened 4 years ago

propensive commented 4 years ago

When errors are highlighted in output, and the caret points at (for example) a bracket, every subsequent symbolic character is highlighted too. This shouldn't be the case.

veyga commented 4 years ago

I've tried to reproduce this error, and haven't been able to. Is there an example? Errors and the associated highlights seem to be reported/highlighted the same as scalac, and don't continue to end of line.

propensive commented 4 years ago

The goal is actually to be better than Scalac's output. The output we get from Bloop (for Scala 2, at least) only gives us the start position of the error. So, if the code and error position are:

  printnl("Hello world")
  ^

our code will read that and underline it as follows:

  printnl("Hello world")
  ^^^^^^^

(Though using ANSI underline and red text, instead of ^s)

But if the error is something like,

  foo(bar())
         ^

that (I think) ends up getting highlighted as,

  foo(bar())
         ^^^

when it should show,

  foo(bar())
         ^^

or even better,

  foo(bar())
      ^^^^^

If the result of a method returns the wrong type, scalac will give us a pointer to the opening parenthesis of the first parameter block.