-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow editors to start an sbt session #243
Comments
Thanks for reporting! I think we should do something along https://github.com/sbt/sbt/blob/e323f1f713251968b3d4ecda8a7f0ed52593713a/vscode-sbt-scala/client/src/extension.ts#L34-L45 with the difference being that we should use the built-in Metals way of starting sbt in case We could possibly use https://code.visualstudio.com/api/references/vscode-api#TerminalProfileProvider so users would be even able to start multiple sbt terminals. We would only need to ask Metals about the way to start an sbt session. @eed3si9n what is the best way of connecting to sbt session? Something like |
For BSP client, the best way to connect to an ongoing session is via following For human users, |
So that would be something that we run in VS Code then?
|
That's effectively what I mentioned in the considered alternatives section. I can already type What I would like instead is for VS Code shell to start the initial sbt session. The benefit of this approach is that the session would be aware of the terminal capability of the VS Code shell, so it would display things in color. Other information regarding the terminal capability might include the width of the window, ANSI X3.64 control (for fancy cursor movements) etc. On the other hand, when using Metals from Neovim, the terminal may not be capable of color, so in that case we don't want to display color. |
Thanks for the explanation! It might harder to make the plugin start the session, but should be doable. |
Is your feature request related to a problem? Please describe.
Describe the solution you'd like
Given that LSP-capable editors like VS Code and Neovim also have a mini-shell environment, I would like Metals to ask the editor plugins to open the build server when it's an interactive build tool like sbt. (For VS Code code could look something like this - https://github.com/sbt/sbt/blob/e323f1f713251968b3d4ecda8a7f0ed52593713a/vscode-sbt-scala/client/src/extension.ts#L34-L45)
This way, we can let Metals drive majority of the interactions as save-compile, test etc, but when we want to perform some sbt commands it would use the built-in shell mechanism.
Describe alternatives you've considered
sbtn
is a decent alternative, so I've tried using that. One of the issue is thatsbtn
was primarily designed to connect to a session that was also originally opened bysbtn
, and the first session captures information regarding the terminal capability. On VS Code specifically this means that I would end up seeing error messages in black-and-white, even though the terminal is capable of colors.So what I end up actually doing is
sbtn shutdown && sbt
. This shuts down the sbt session opened by Metals, and I can start a new one that Metals hopefully reconnects.Additional contex
Previously this was filed as scalameta/metals#2152
Search terms
sbt
The text was updated successfully, but these errors were encountered: