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

Support for deserializing params *object* as single first parameter #289

Closed
AArnott opened this issue Jun 4, 2019 · 1 comment · Fixed by #347
Closed

Support for deserializing params *object* as single first parameter #289

AArnott opened this issue Jun 4, 2019 · 1 comment · Fixed by #347

Comments

@AArnott
Copy link
Member

AArnott commented Jun 4, 2019

To improve LSP servers' interop with LSP clients when implemented with StreamJsonRpc, consider an option on JsonRpc that allows server methods to receive all named arguments via one deserialized type specified as the server method's first/only parameter.

This could replace the one JToken parameter from LSP server methods with the anticipated type per the LSP spec that is already provided by an LSP protocol library. So instead of a server method boilerplate looking like this:

public async Task TextDocumentCompletion(JToken token, CancellationToken token) {
   var request = token.ToObject<CompletionParams>();
}

It could look like this:

public async Task TextDocumentCompletion(CompletionParams request, CancellationToken token) {
}
@AArnott
Copy link
Member Author

AArnott commented Jun 4, 2019

This option allows the LSP library to add properties to the CompletionParams type (for example) without method signatures being updated. The downside is this is a clear departure from the expected behavior of JSON-RPC behavior, which states that named arguments should be matched to method parameters. But we're not really losing anything there since we're already just packing it all as a JToken.

AArnott pushed a commit that referenced this issue Oct 30, 2024
Bumps [dotnet-coverage](https://github.com/microsoft/codecoverage) from 17.12.3 to 17.12.4.
- [Commits](https://github.com/microsoft/codecoverage/commits)

---
updated-dependencies:
- dependency-name: dotnet-coverage
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant