Code Monkey home page Code Monkey logo

Comments (6)

adpi2 avatar adpi2 commented on June 18, 2024

Thanks for the report!

I don't expect the SBT_OPTS to be propagated to the BSP config. However the server should read the SBT_OPTS when started by the BSP command. It is a bug if it does not.

from sbt.

kasiaMarek avatar kasiaMarek commented on June 18, 2024

However the server should read the SBT_OPTS when started by the BSP command. It is a bug if it does not.

That seems to work as expected.

I don't expect the SBT_OPTS to be propagated to the BSP config.

Is there a different way to add -Dsbt.boot.directory=<some_path> option to the bsp config permanently ? The trouble is that if you add it manually, sbt seems to regenerate the config quite a lot, and the option disappears.

from sbt.

adpi2 avatar adpi2 commented on June 18, 2024

Is there a different way to add -Dsbt.boot.directory=<some_path> option to the bsp config permanently ?

No I don't think it is currently possible without a fix in sbt itself.

My suggestion would be to change the way sbt generates the BSP config. It should generate .../sbt -bsp instead of .../java ... xsbt.boot.Boot -bsp. That would solve your issue because the sbt script does read the SBT_OPTS env.

It would solve other issues like:

  • it does not start with the current Java version in the path
  • it does not use the native sbt client

from sbt.

kasiaMarek avatar kasiaMarek commented on June 18, 2024

My suggestion would be to change the way sbt generates the BSP config.

How should we generate the config then? We generate it running .../sbt bspConfig wouldn't that be the preferred way?

from sbt.

adpi2 avatar adpi2 commented on June 18, 2024

We generate it running .../sbt bspConfig wouldn't that be the preferred way?

Yes it is.

I am suggesting to change the implementation of sbt bspConfig in sbt. The code is here:

private[sbt] def writeConnectionFile(sbtVersion: String, baseDir: File): Unit = {
val bspConnectionFile = new File(baseDir, ".bsp/sbt.json")
val javaHome = System.getProperty("java.home")
val classPath = System.getProperty("java.class.path")
val sbtScript = Option(System.getProperty("sbt.script"))
.orElse(sbtScriptInPath)
.map(script => s"-Dsbt.script=$script")
// IntelliJ can start sbt even if the sbt script is not accessible from $PATH.
// To do so it uses its own bundled sbt-launch.jar.
// In that case, we must pass the path of the sbt-launch.jar to the BSP connection
// so that the server can be started.
// A known problem in that situation is that the .sbtopts and .jvmopts are not loaded.
val sbtLaunchJar = classPath
.split(File.pathSeparator)
.find(jar => SbtLaunchJar.findFirstIn(jar).nonEmpty)
.map(_.replace(" ", "%20"))
.map(jar => s"--sbt-launch-jar=$jar")
val argv =
Vector(
s"$javaHome/bin/java",
"-Xms100m",
"-Xmx100m",
"-classpath",
classPath,
) ++
sbtScript ++
Vector("xsbt.boot.Boot", "-bsp") ++
(if (sbtScript.isEmpty) sbtLaunchJar else None)
val details = BspConnectionDetails(name, sbtVersion, bspVersion, languages, argv)
val json = Converter.toJson(details).get
IO.write(bspConnectionFile, CompactPrinter(json), append = false)
}

from sbt.

kasiaMarek avatar kasiaMarek commented on June 18, 2024

Oh, yeah, sorry. I misread what you wrote.

from sbt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.