-
Notifications
You must be signed in to change notification settings - Fork 151
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 flexible named arg matching #288
Comments
The good part of this proposal (compared to #289) is that it remains largely true to the JSON-RPC spec with regard to its intended treatment of named arguments. The possible negative is that server methods have to change their signature (and the author must refer to the spec to see what parameters it might accept) in order to receive additional data, so it's less discoverable than a single strongly-typed object as described in #289. |
I would actually go with this proposal since it matches the original idea of having named arguments. However we could never unfold them correctly in JS/TS (no reflection) but it would be the right thing to do.
Could these be nullable types in C# and |
Yes, the default value for nullable types is |
Wasn't aware of this. |
Bumps [dotnet-coverage](https://github.com/microsoft/codecoverage) from 17.12.2 to 17.12.3. - [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>
The LSP spec always uses named arguments. It assumes that adding arguments is a non-breaking change. For StreamJsonRpc though, a client adding or removing a named argument is a breaking change for a server because our method overload selector works by matching every single named argument to every single method parameter.
Today, StreamJsonRpc users that implement LSP servers do so by accepting a single
JToken
parameter. It may offer a preferable experience if server methods could actually use the named parameters in the method signature, without becoming brittle to LSP spec changes.The proposal here is to add an option to
JsonRpc
that allows it to "fuzzy match" target methods based on named arguments. When no named argument specifies a value for a method parameter, the default value for that parameter type is provided. When no parameter on the target method matches the name of a named argument, that argument is ignored.The text was updated successfully, but these errors were encountered: