-
Notifications
You must be signed in to change notification settings - Fork 948
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
Make it possible for sbt plugins to register server handlers for custom JSON-RPC methods #3890
Comments
I am on board with making sbt server more extensible, especially for experimenting with new feature proposals. |
SGTM too. My only concern is I'd like to try and keep the compatibility promises to some reasonable minimum, so we have flexibility to change the internal details of the server without breaking any server-extending plugins that will have been published. |
I would be OK with no compatibility promises. Internal APIs are fine. Ideally, I'd like to see these methods handled in sbt server by default in the long term. I think a good first step towards that direction would be to allow quicker experimentation via sbt plugins. |
Fixes sbt#3890 Here's an example: ```scala Global / serverHandlers += ServerHandler({ callback => import callback._ import sjsonnew.BasicJsonProtocol._ import sbt.internal.protocol.JsonRpcRequestMessage ServerIntent( { case r: JsonRpcRequestMessage if r.method == "lunar/helo" => jsonRpcNotify("lunar/oleh", "") () }, PartialFunction.empty ) ```
Fixes sbt#3890 Here's an example: ```scala Global / serverHandlers += ServerHandler({ callback => import callback._ import sjsonnew.BasicJsonProtocol._ import sbt.internal.protocol.JsonRpcRequestMessage ServerIntent( { case r: JsonRpcRequestMessage if r.method == "lunar/helo" => jsonRpcNotify("lunar/oleh", "") () }, PartialFunction.empty ) ```
Fixes sbt#3890 Here's an example: ```scala Global / serverHandlers += ServerHandler({ callback => import callback._ import sjsonnew.BasicJsonProtocol._ import sbt.internal.protocol.JsonRpcRequestMessage ServerIntent( { case r: JsonRpcRequestMessage if r.method == "lunar/helo" => jsonRpcNotify("lunar/oleh", "") () }, PartialFunction.empty ) ```
problem
I have integrated with sbt server in my language server and managed to trigger compile on file save scalameta/metals#170 I am very excited about the potential for using sbt server from an IDE to simplify the "Import project" step.
Would it be possible to give sbt plugins the ability to register handlers for custom JSON-RPC methods? Currently, sbt hardcodes a handful of LSP methods in
sbt/main/src/main/scala/sbt/internal/server/LanguageServerProtocol.scala
Line 54 in d107100
initialize
andtextDocument/didSave
. I would love to be able to write an sbt plugin that adds handler to respond to custom methods. In particular, I am interested in implementing methods from https://github.com/scalacenter/bsp/blob/master/docs/bsp.md to simplify project import when the user opens a directory with an sbt build.expectation
Just brainstorming, maybe there could be a
sbtServerMethods: SettingKey[List[JsonRpcMethodHandler]]
wherenotes
sbt version: 1.1.0
The text was updated successfully, but these errors were encountered: