Skip to content
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 sbt server extensible #3975

Merged
merged 3 commits into from
Mar 15, 2018
Merged

make sbt server extensible #3975

merged 3 commits into from
Mar 15, 2018

Conversation

eed3si9n
Copy link
Member

Fixes #3890

Here's an example:

    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
      )

Copy link
Member

@dwijnand dwijnand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 request, 1 question

rest LGTM

*/

package sbt

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you make these sbt.internal.server please so we can break their API, please?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are exposing this out to plugins, then it needs to be public, no?
Are we saying that people can extend it, but the extension is not guaranteed to work down the line?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it's exposed with 0 compatibility promises. caveat emptor

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine if it's presented as an experimental/beta functionality.

lazy val fallback: ServerHandler = ServerHandler({ handler =>
ServerIntent(
{ case x => handler.log.debug(s"Unhandled notification received: ${x.method}") },
{ case x => handler.log.debug(s"Unhandled request received: ${x.method}") }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any particular reason not to print the whole object like before?

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
      )
```
@dwijnand dwijnand added this to the 1.2.0 milestone Mar 15, 2018
@dwijnand dwijnand merged commit 087f217 into sbt:1.x Mar 15, 2018
@eed3si9n eed3si9n deleted the wip/serverext branch March 15, 2018 02:08
@eed3si9n
Copy link
Member Author

woohoo!

@dwijnand
Copy link
Member

sorry I only realised during the sbt meeting that you'd pushed the last commit 2 days ago.. :-/

Copy link
Member

@olafurpg olafurpg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woot, looking forward to give this a spin! Thanks 😄

@jvican
Copy link
Member

jvican commented Mar 15, 2018

This is a good first step to have bsp support in sbt, thanks for doing it. 👍

@jvican
Copy link
Member

jvican commented May 30, 2018

Hasn't this been released in an sbt version? This is blocking me from implementing a bsp prototype in sbt.

@jvican
Copy link
Member

jvican commented May 30, 2018

@eed3si9n Would be really helpful if we can get this in a release soon so that I can work on the bsp prototype plugin ^^

@eed3si9n
Copy link
Member Author

eed3si9n commented Jun 5, 2018

Yea. We'll try to get some 1.2.0 milestone out soonish.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants