-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b716449
commit 38a068e
Showing
16 changed files
with
144 additions
and
270 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,45 @@ | ||
package afenton.bazel.bsp.protocol | ||
|
||
import afenton.bazel.bsp.Logger | ||
import afenton.bazel.bsp.jrpc.JRpcClient | ||
import afenton.bazel.bsp.jrpc.Message | ||
import afenton.bazel.bsp.jrpc.Notification | ||
import cats.effect.IO | ||
import cats.effect.std.Queue | ||
|
||
trait BspClient: | ||
def publishDiagnostics(params: PublishDiagnosticsParams): IO[Unit] | ||
def buildTaskStart(params: TaskStartParams): IO[Unit] | ||
def buildTaskProgress(params: TaskProgressParams): IO[Unit] | ||
def buildTaskFinished(params: TaskFinishParams): IO[Unit] | ||
def buildShowMessage(params: ShowMessageParams): IO[Unit] | ||
|
||
object BspClient: | ||
|
||
def toQueue(outQ: Queue[IO, Message], logger: Logger): BspClient = | ||
BspClientImpl(outQ, logger) | ||
|
||
private class BspClientImpl(outQ: Queue[IO, Message], logger: Logger) | ||
extends BspClient | ||
with JRpcClient: | ||
|
||
def sendNotification(n: Notification): IO[Unit] = | ||
for | ||
_ <- logger.info(n.method) | ||
_ <- outQ.offer(n) | ||
yield () | ||
|
||
def publishDiagnostics(params: PublishDiagnosticsParams): IO[Unit] = | ||
sendNotification("build/publishDiagnostics", params) | ||
|
||
def buildTaskStart(params: TaskStartParams): IO[Unit] = | ||
sendNotification("build/taskStart", params) | ||
|
||
def buildTaskProgress(params: TaskProgressParams): IO[Unit] = | ||
sendNotification("build/taskProgress", params) | ||
|
||
def buildTaskFinished(params: TaskFinishParams): IO[Unit] = | ||
sendNotification("build/taskFinish", params) | ||
|
||
def buildShowMessage(params: ShowMessageParams): IO[Unit] = | ||
sendNotification("build/showMessage", params) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.