fix!: make lsp-server Response type closer aligned to JSON-RPC#22753
Open
ribru17 wants to merge 1 commit into
Open
fix!: make lsp-server Response type closer aligned to JSON-RPC#22753ribru17 wants to merge 1 commit into
Response type closer aligned to JSON-RPC#22753ribru17 wants to merge 1 commit into
Conversation
From [the JSON-RPC 2.0 protocol](https://www.jsonrpc.org/specification#response_object): > result > This member is REQUIRED on success. > This member MUST NOT exist if there was an error invoking the method. > The value of this member is determined by the method invoked on the Server. > error > This member is REQUIRED on error. > This member MUST NOT exist if there was no error triggered during invocation. > The value for this member MUST be an Object as defined in section 5.1. > > ... > > Either the result member or error member MUST be included, but both members MUST NOT be included. The current typing of the `Response` object allows both the `result` and `error` members to be present, or for neither to be present. This commit strengthens the typing of the response to prevent these cases from being expressed. This is a breaking change. The response kind definition is borrowed from the [tower-lsp](https://github.com/ebkalderon/tower-lsp) definition.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
From the JSON-RPC 2.0 protocol:
The current typing of the
Responseobject allows both theresultanderrormembers to be present, or for neither to be present. This commit strengthens the typing of the response to prevent these cases from being expressed. This is a breaking change.The response kind definition is borrowed from the
tower-lsp definition.