JetBrains/bazel-bsp

Invalid diagnostics

kpodsiad opened this issue · 1 comments

I've created a plain project to play with bazel-bsp and bazel itself.
In this project there is following file:

object Main extends App {
  println(s"hello from bazel ${Foo.x}")
  val x: Int = "adfs" << compilation error
}

However, there are no error diagnostics sent for that file.

Diagnostics for Main.scala
"Params": {
  "textDocument": {
    "uri": "file:///.../bazel-scala/src/main/scala/me/kpodsiad/Main.scala"
  },
  "buildTarget": {
    "uri": "//:App"
  },
  "diagnostics": [],
  "reset": true
}

Instead, diagnostics are send for the BUILD file. Moreover, after fixing error, there are no empty diagnostics sent to the client and it doesn't know whether to clear or not to clear already received diagnostics

Diagnostics for Main.scala
"Params": {
  "textDocument": {
    "uri": "file:///.../bazel/bazel-scala/BUILD"
  },
  "buildTarget": {
    "uri": ""
  },
  "diagnostics": [
    {
      "range": {
        "start": {
          "line": 2,
          "character": 13
        },
        "end": {
          "line": 2,
          "character": 13
        }
      },
      "severity": 1,
      "message": "ERROR: /.../bazel-scala/BUILD:2:13: scala //:App failed: (Exit 1): scalac failed: error executing command bazel-out/darwin-opt-exec-2B5CBBC6/bin/external/io_bazel_rules_scala/src/java/io/bazel/rulesscala/scalac/scalac @bazel-out/darwin-fastbuild/bin/App.jar-0.params"
    }
  ],
  "reset": false
}

similar to #67