Comments (5)
I faintly recall that we had a reason why we couldn't support this, but I don't remember it now. So perhaps it's fine. @tinaschrepfer might remember.
from vs-streamjsonrpc.
Are the any updates on this? It would be quite useful for implementing the Language Server Protocol.
from vs-streamjsonrpc.
@efoerster We haven't given this any further thought. Can you elaborate on how Language Server Protocol requires this? We have at least some LSP messages going over streamjsonrpc as it is today.
from vs-streamjsonrpc.
@AArnott It's not required. But with this limitation the signature of remote method has to be like this
[JsonRpcMethod(Methods.TextDocumentDidOpen)]
public void OnTextDocumentOpened(JToken arg)
{
var parameter = arg.ToObject<DidOpenTextDocumentParams>();
...
}
Or do I miss something? Instead it would be pretty cool if we could avoid the manual conversion and deduce the type via reflection from the declaration in the target class:
[JsonRpcMethod(Methods.TextDocumentDidOpen)]
public void OnTextDocumentOpened(DidOpenTextDocumentParams arg)
{
...
}
from vs-streamjsonrpc.
@efoerster can you share an example of the JSON-RPC message itself (i.e. the json) that would invoke this method?
If the JToken
you are receiving is actually a JObject
that directly deserializes to a DidOpenTextDocumentParams
, then once we support named arguments, the C# method would not look like what you've proposed, but rather it would take this form:
[JsonRpcMethod(Methods.TextDocumentDidOpen)]
public void OnTextDocumentOpened(TextDocumentItem TextDocument) {}
This is because per the json-rpc spec, when using the params object, each field on that object...
with member names that match the Server expected parameter names. The absence of expected names MAY result in an error being generated. The names MUST match exactly, including case, to the method's expected parameters.
So if the params object today in JSON is actually the serialized version of a DidOpenTextDocumentParams
object, then that type's members (and not the type itself) must be what the method takes as parameters.
Does that raise any concerns for you?
from vs-streamjsonrpc.
Related Issues (20)
- Add support for call-scoped marshaled objects
- StartListening Thread can take 20-30+ seconds to run HOT 1
- We should document and test the case of sending the same RpcMarshalable object across several top-level RPC methods
- Consider using finalizer and weak references to avoid leaks when proxies are abandoned HOT 2
- Parent <-> child communication design.
- StreamJsonRpc + system.text.json throws hasValue exception if using SingleObjectParameterDeserialization and default parameter HOT 2
- Empty array sent instead of empty object when named arguments should be used
- Add TFM to enable reduction in explicit dependencies HOT 2
- Allow `[RpcMarshalable]` interfaces to declare properties with serialized values HOT 4
- JSON Contract resolver needs to be reused HOT 1
- Support MessagePackFormatterAttribute applied to RPC methods
- User-supplied `TypelessObjectResolver` from MessagePack causes `IAsyncEnumerable<T>` to malfunction
- Support System.Text.Json compatible Json Converter for Request ID HOT 4
- Use camelCase for response objects HOT 4
- Intercept a request and modify it before sending to the server HOT 7
- Connection with Java-based JSON-RPC server fails because Content-Length is required HOT 2
- package downgrade caused by v2.17.8 HOT 7
- JoinableTaskFactory bridge fails with multiple JsonRpc instances in a process without JTF HOT 4
- Deserialization of nested objects when using System.Text.Json HOT 2
- IAsyncEnumerable handler can be cleaned up early HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vs-streamjsonrpc.