Skip to content

Commit

Permalink
semanticdb working
Browse files Browse the repository at this point in the history
  • Loading branch information
aishfenton committed Nov 30, 2023
1 parent 225ff55 commit 4ae09c1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions examples/simple-no-errors/src/example/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ import example.foo.Bar
object Main extends App {
val f = Foo(1)
val b = Bar("b")

Console.println(s"Hello World. I have $f, $b")
}
17 changes: 13 additions & 4 deletions src/main/scala/bazeltools/bsp4bazel/runner/BspTaskRunner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ object BspTaskRunner:
scalaVersion = info.scalaVersion,
scalaBinaryVersion = majorVersion(info.scalaVersion),
platform = ScalaPlatform.JVM,
jars = info.scalaCompileJars.map(p => UriFactory.fileUri(workspaceRoot.resolve(p))),
jars = info.scalaCompileJars.map(p =>
UriFactory.fileUri(workspaceRoot.resolve(p))
),
jvmBuildTarget = None
).asJson
)
Expand All @@ -109,9 +111,16 @@ object BspTaskRunner:
def asScalaOptionItem: ScalacOptionsItem =
ScalacOptionsItem(
target = id,
options = info.scalacOptions,
classpath = info.classpath.map(p => UriFactory.fileUri(workspaceRoot.resolve(p))),
classDirectory = UriFactory.fileUri(workspaceRoot.resolve(info.semanticdbTargetRoot))
// NB: Metals looks for these parameters to be set specifically. They don't really do anything here as
// semanticdb is instead configured in the Bazel rules.
options = List(
s"-Xplugin:${info.semanticdbPluginjar}",
s"-P:semanticdb:sourceroot:${workspaceRoot}"
) ::: info.scalacOptions,
classpath =
info.classpath.map(p => UriFactory.fileUri(workspaceRoot.resolve(p))),
classDirectory =
UriFactory.fileUri(workspaceRoot.resolve(info.semanticdbTargetRoot))
)

case class BspTargetInfo(
Expand Down

0 comments on commit 4ae09c1

Please sign in to comment.