Open tgodzik opened 10 months ago
If you will need an sbt file or smth like that, just mention me.
The issue seems to be the bsp config generated by sbt
(.bsp/sbt.json
). The args for starting the server are:
[some-path]/java -Xms100m -Xmx100m -classpath [some-path]/sbt-launch.jar -Dsbt.script=[some-path]/sbt xsbt.boot.Boot -bsp
Which will work if -Dsbt.boot.directory=...
is added explicitly but won't pick up sbt opts. I feel like maybe sbt
should pass those options when generating the config.
If one manually adds this option to args in .bsp/sbt.json
it will work as expected, the problem is that sbt
regenerates .bsp/sbt.json
a lot, so this would have to be fixed constantly.
In metals we could insert such options when we start the sbt server, but that would work under the assumption that we know how the command for starting the server looks like, which is suboptimal, since metals should be oblivious to such things.
Shouldn't the environment variable work though? We start the process, so maybe we must make sure these variables are passed to sbt? We can suggest to restart if they changed.
It seems that it's not possible to fix this while launching via launcher, instead we should check if sbt is available on PATH and use it. For most advanced users it should be on the PATH.
Alternatively, you should be able to specify path to sbt by hand in the settings and it should work. (to be checked)
@untainsYD did setting sbt script in metals settings actually solved the issue for you?
This issue was closed because no new information was added for the last 30 days. If you have any relevant information, feel free to add it and reopen the issue.
@untainsYD did setting sbt script in metals settings actually solved the issue for you?
No, it didn't, i have sbt option set, but nothing changed
It always recreates ~/.sbt
folder in home directory.
Looks like maybe the env variable is not forwarded to Metals. Might be useful to start VS Code using code
command from console. We should be forwarding the environment variable correctly otherwise :thinking:
I don't think it will work right now. So it seems that starting sbt
server using.../java ... xsbt.boot.Boot -bsp
causes .sbt
to be created (one would have to pass Dsbt.boot.directory=
arg to it). This command isn't generated by Metals but by sbt via sbt bspConfig
command, so an upstream fix seems to be needed here. Here is the sbt issue https://github.com/sbt/sbt/issues/7469.
@tgodzik @kasiaMarek sorry for bothering you, but now with Metals version: 1.3.2+31-093989ec-SNAPSHOT
last update i have .metals
folder generated in my home user folder within the project folder .metals
.
I think that would be shared indexes so that we don't reindex JDK etc. which can take a long while
I think that would be shared indexes so that we don't reindex JDK etc. which can take a long while
i got it, but having it on XDG_PATH
would be very nice.
Discussed in https://github.com/scalameta/metals/discussions/5775