scalameta / metals

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

scala tests like test("...") not recognized most of the time #6809

Open kostaskougios opened 1 month ago

kostaskougios commented 1 month ago

Describe the bug

Most of the time scala tests are not recognised (I am using vscode). I can still run a test class but each test is not reported, instead the error for every test is reported at the class level.

i would expect to see the green circle near the test like below:

image

But most of the time I don't see it. clean-build, re-import, restart of the IDE most of the time doesn't help but some times it does.

The tests are randomly recognised at later times.

Note: the code compiles correctly when the issue occurs.

Expected behavior

The tests to be recognised as per below:

image

Operating system

macOS

Editor/Extension

VS Code

Version of Metals

v1.39.6 (pre-release)

Extra context or search terms

scalatest

kostaskougios commented 1 month ago

Note I don't see anything strange in .metals/bsp.trace.json when the issue occurs

Ravenow commented 3 weeks ago

I can confirm here, vscode-1.94.2, metals-v1.39.0. only test classes are visible in test explorer and its impossible to run single test-case. Tests implemented with scalatest

изображение and here is idea for comparision изображение

tgodzik commented 5 days ago

I think another thing we might want to use is the presentation compiler for finding tests cases, which should be much more error proof

kostaskougios commented 5 days ago

Btw the issue is not limited only to test cases. @main def myMain() method recognition is on and off a lot of the time. (for code that compiles fine)