-
Notifications
You must be signed in to change notification settings - Fork 6
Bump jsonrpclib #210
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
Open
ghostbuster91
wants to merge
20
commits into
neandertech:main
Choose a base branch
from
ghostbuster91:bump-jsonrpclib
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Bump jsonrpclib #210
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
b6d8a57
bump jsonrpclib
kubukoz d54ecea
bump scalajs
kubukoz 35144b6
Add sonatype snapshots
kubukoz 20b63e9
publish always, yolo
kubukoz 8083e32
Merge branch 'main' into bump-jsonrpclib
kubukoz c1af97d
bump to latest
kubukoz 67f3f63
wip
kubukoz b3bfd7f
Replace jsoniter with circe in tracer
ghostbuster91 af40d88
Merge pull request #1 from ghostbuster91/bump-jsonrpclib
kubukoz 0eebf15
fix tracer tests
ghostbuster91 628028d
Fix LSPTests
ghostbuster91 d874825
Revert redundant changes
ghostbuster91 e8b3f7d
Merge pull request #2 from ghostbuster91/bump-jsonrpclib
kubukoz 7f63d24
Refactor testkit
ghostbuster91 ec9c9f2
Fix EndToEndTests
ghostbuster91 4174ad9
Update to latest snapshot
ghostbuster91 9780297
Update jsonrpclib snapshot
ghostbuster91 c1b8fef
Update build.sbt
ghostbuster91 5f66164
Merge branch 'main' into bump-jsonrpclib
ghostbuster91 71da751
Define circe codec for LSPCancelRequest
ghostbuster91 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -23,31 +23,42 @@ import upickle.core.TraceVisitor.TraceException | |
| import upickle.default.* | ||
|
|
||
| import requests.* | ||
| import io.circe.Codec | ||
| import com.github.plokhotnyuk.jsoniter_scala.circe.JsoniterScalaCodec.* | ||
| import com.github.plokhotnyuk.jsoniter_scala.core.readFromString | ||
| import com.github.plokhotnyuk.jsoniter_scala.core.writeToString | ||
| import io.circe.Json | ||
| import io.circe.HCursor | ||
| import io.circe.Decoder.Result | ||
| import io.circe.DecodingFailure | ||
|
|
||
| private[langoustine] object jsonrpcIntegration: | ||
| object jsonrpcIntegration: | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thought: needed to make this public so that it can be used in the |
||
| val nullArray = "null".getBytes() | ||
| given codec[T: Reader: Writer]: Codec[T] = | ||
| new Codec[T]: | ||
| override def decode( | ||
| payload: Option[Payload] | ||
| ): Either[ProtocolError, T] = | ||
| payload | ||
| .map(_.stripNull.map(_.array).getOrElse(nullArray)) | ||
| .toRight(ProtocolError.InvalidParams("missing payload")) | ||
| .flatMap: arr => | ||
| Try(read[T](arr, trace = true)).toEither.left.map { | ||
| case te: TraceException => | ||
| val e = te.getCause() | ||
| ProtocolError.InvalidParams( | ||
| s"invalid payload at ${te.jsonPath}: " + e.getMessage | ||
| ) | ||
|
|
||
| case e => | ||
| ProtocolError.InternalError("oopsie daisy: " + e.getMessage) | ||
| } | ||
|
|
||
| override def encode(a: T): Payload = | ||
| Payload(write(a).getBytes) | ||
|
|
||
| override def apply(c: HCursor): Result[T] = | ||
| Try(read[T](writeToString[Json](c.value))).toEither.left.map { | ||
| case te: TraceException => | ||
| val e = te.getCause() | ||
| DecodingFailure( | ||
| DecodingFailure.Reason.CustomReason( | ||
| s"invalid payload at ${te.jsonPath}: " + e.getMessage | ||
| ), | ||
| c | ||
| ) | ||
|
|
||
| case e => | ||
| DecodingFailure( | ||
| DecodingFailure.Reason.CustomReason( | ||
| "oopsie daisy: " + e.getMessage | ||
| ), | ||
| c | ||
| ) | ||
| } | ||
|
|
||
| override def apply(a: T): Json = | ||
| readFromString[Json](write(a)) | ||
|
|
||
| def handlerToEndpoint[F[_]: Monadic, T <: LSPRequest](req: T)( | ||
| f: req.In => F[req.Out] | ||
|
|
||
This file contains hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: would it be possible for langoustine to switch from ujson to circe? That would help a lot with all these conversions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@keynmol thoughts?