scalameta / metals

Scala language server with rich IDE features 🚀

Home Page:https://scalameta.org/metals/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing error diagnostics using Bazel (for Scala 2.x)

aishfenton opened this issue · comments

commented

Describe the bug

Error diagnostics aren't showing when using Bazel and Metals. This time though for Scala 2.12 (I see the other issue for Scala3 but I presume that's a separate issue).

Expected behavior

No response

Operating system

Linux

Editor/Extension

VS Code

Version of Metals

v1.2.2

Extra context or search terms

See this in the metals.log:

2024.04.05 23:53:46 INFO  INFO: Found 1 target...�[0m
2024.04.05 23:53:46 INFO  checking cached actions�[0m
2024.04.05 23:53:46 INFO  [0 / 2] [Prepa] BazelWorkspaceStatusAction stable-status.txt�[0m
2024.04.05 23:53:46 INFO  [1 / 2] scala @//.../netflix/aeviz/service:service; 0s remote-cache, worker�[0m
2024.04.05 23:53:47 INFO  ERROR: /home/coder/rankresearchv2/aeviz/src/main/scala/com/netflix/aeviz/service/BUILD.bazel:10:14: scala @//aeviz/src/main/scala/com/netflix/aeviz/service:service failed: (Exit 1): scalac failed: error executing command (from target //aeviz/src/main/scala/com/netflix/aeviz/service:service) bazel-out/k8-opt-exec-2B5CBBC6/bin/external/io_bazel_rules_scala/src/java/io/bazel/rulesscala/scalac/scalac '--jvm_flag=-DNetflixInvalidateCacheArg=20220508' '--jvm_flag=-Xss2m' '--jvm_flag=-Xmx2g' ... (remaining 1 argument skipped)�[0m
2024.04.05 23:53:47 INFO  aeviz/src/main/scala/com/netflix/aeviz/service/RankService.scala:49: error: not found: value asfd�[0m
2024.04.05 23:53:47 INFO  asfd�[0m
2024.04.05 23:53:47 INFO  ^�[0m
2024.04.05 23:53:47 INFO  aeviz/src/main/scala/com/netflix/aeviz/service/RankService.scala:87: warning: local val seed in method applyOrElse is never used�[0m
2024.04.05 23:53:47 INFO  val seed = s.getOrElse(defaultSeed)�[0m
2024.04.05 23:53:47 INFO  ^�[0m
2024.04.05 23:53:47 INFO  aeviz/src/main/scala/com/netflix/aeviz/service/RankService.scala:113: warning: local val seed in method applyOrElse is never used�[0m
2024.04.05 23:53:47 INFO  val seed = s.getOrElse(defaultSeed)�[0m
2024.04.05 23:53:47 INFO  ^�[0m
2024.04.05 23:53:47 INFO  aeviz/src/main/scala/com/netflix/aeviz/service/RankService.scala:134: warning: local val seed in method applyOrElse is never used�[0m
2024.04.05 23:53:47 INFO  val seed = s.getOrElse(defaultSeed)�[0m
2024.04.05 23:53:47 INFO  ^�[0m
2024.04.05 23:53:47 INFO  three warnings found�[0m
2024.04.05 23:53:47 INFO  one error found�[0m
2024.04.05 23:53:47 INFO  Build failed�[0m
2024.04.05 23:53:47 INFO  java.lang.RuntimeException: Build failed�[0m
2024.04.05 23:53:47 INFO  at io.bazel.rulesscala.scalac.ScalacInvoker.invokeCompiler(ScalacInvoker.java:53)�[0m
2024.04.05 23:53:47 INFO  at io.bazel.rulesscala.scalac.ScalacWorker.compileScalaSources(ScalacWorker.java:253)�[0m
2024.04.05 23:53:47 INFO  at io.bazel.rulesscala.scalac.ScalacWorker.work(ScalacWorker.java:69)�[0m
2024.04.05 23:53:47 INFO  at io.bazel.rulesscala.worker.Worker.persistentWorkerMain(Worker.java:86)�[0m
2024.04.05 23:53:47 INFO  at io.bazel.rulesscala.worker.Worker.workerMain(Worker.java:39)�[0m
2024.04.05 23:53:47 INFO  at io.bazel.rulesscala.scalac.ScalacWorker.main(ScalacWorker.java:33)�[0m

Thanks for reporting! Did this happen before, were there any changes to bazel/rules-scala versions?

commented

First time I've got this far (a couple of previous, now resolved, bazel-bsp issues meant we hadn't got past import until now).

Hmm... does this happen for you on some sample Bazel repos or only in yours? Are you able to provide the versions of Bazel rules-scala and bazel-bsp versions you are using?

commented

We're using Scala 2.12.18, Bazel 6.3.2, rules_scala 6.4.0 and nightly build of Metals 1.2.2+99-c0e45169-SNAPSHOT (can update to a newer nightly if that helps?)

Looks like this might be related to JetBrains/bazel-bsp#547 (comment)

Some diagnostics are sent with progress, which is not read by Bazel BSP. We can confirm once the fix is merged.