fury-old icon indicating copy to clipboard operation
fury-old copied to clipboard

error highlighting of symbols is unreliable

Open propensive opened this issue 5 years ago • 2 comments

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.

propensive avatar Feb 11 '20 12:02 propensive

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.

veyga avatar May 08 '20 16:05 veyga

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.

propensive avatar May 08 '20 16:05 propensive