scalameta / metals

Scala language server with rich IDE features 🚀
https://scalameta.org/metals/
Apache License 2.0
2.09k stars 330 forks source link

Java error not shown #4350

Open Arthurm1 opened 2 years ago

Arthurm1 commented 2 years ago

Describe the bug

Create a java file with the following...

class Foo {
  String bar = "bar";
}

this compiles fine and if errors are introduced then they are reported on the VSCode Problems page and highlighted in red.

Now change bar to...

class Foo {
  String foo = "\{x} plus \{y} equals \{x + y}";
}

Now there are java tokenisation errors in the logs because the String is invalid which is fine but there are no errors on the Problems page and nothing highlighted in red. Also there are stale bloop error: error: illegal escape character errors but only in the Metals logs. The stale error seems correct - I'd expect that to show on the Problems page.

I'm using Bloop v1.5.3-40-0bd25506 and jdk 17

Expected behavior

I'd expect to see the errors on the Problems page and highlighted in the file.

Operating system

Windows

Editor/Extension

VS Code

Version of Metals

0.11.8+80-2aa68622-SNAPSHOT

Extra context or search terms

No response

tgodzik commented 2 years ago

Thanks for reporting, this might be related to tokenization that we do in Metals :thinking: It's needed to calculate the current position for the diagnostic.