Skip to content

Commit 732860f

Browse files
started serializer refactor
1 parent 4aac564 commit 732860f

File tree

133 files changed

+275
-292
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+275
-292
lines changed

src/Client/Protocol/ClientMessage.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
using Newtonsoft.Json;
22
using Newtonsoft.Json.Linq;
33
using Newtonsoft.Json.Serialization;
4+
using OmniSharp.Extensions.LanguageServer.Protocol;
45

56
namespace OmniSharp.Extensions.LanguageServer.Client.Protocol
67
{
78
/// <summary>
89
/// The client-side representation of an LSP message.
910
/// </summary>
10-
[JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))]
1111
public class ClientMessage
1212
{
1313
/// <summary>
@@ -19,7 +19,7 @@ public class ClientMessage
1919
/// <summary>
2020
/// The request / response Id, if the message represents a request or a response.
2121
/// </summary>
22-
[JsonProperty(DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate, NullValueHandling = NullValueHandling.Ignore)]
22+
[Optional]
2323
public object Id { get; set; }
2424

2525
/// <summary>
@@ -30,13 +30,13 @@ public class ClientMessage
3030
/// <summary>
3131
/// The request / notification message, if the message represents a request or a notification.
3232
/// </summary>
33-
[JsonProperty(DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate, NullValueHandling = NullValueHandling.Ignore)]
33+
[Optional]
3434
public JObject Params { get; set; }
3535

3636
/// <summary>
3737
/// The response message, if the message represents a response.
3838
/// </summary>
39-
[JsonProperty(DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate, NullValueHandling = NullValueHandling.Ignore)]
39+
[Optional]
4040
public JObject Result { get; set; }
4141
}
4242
}

src/Client/Protocol/ErrorMessage.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
using Newtonsoft.Json;
22
using Newtonsoft.Json.Linq;
33
using Newtonsoft.Json.Serialization;
4+
using OmniSharp.Extensions.LanguageServer.Protocol;
45

56
namespace OmniSharp.Extensions.LanguageServer.Client.Protocol
67
{
78
/// <summary>
89
/// A JSON-RPC error message.
910
/// </summary>
10-
[JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))]
1111
public class ErrorMessage
1212
{
1313
/// <summary>
@@ -23,7 +23,7 @@ public class ErrorMessage
2323
/// <summary>
2424
/// Optional data associated with the message.
2525
/// </summary>
26-
[JsonProperty(DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
26+
[Optional]
2727
public JToken Data { get; set; }
2828
}
2929
}

src/Client/Protocol/ServerMessage.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
using Newtonsoft.Json;
22
using Newtonsoft.Json.Linq;
33
using Newtonsoft.Json.Serialization;
4+
using OmniSharp.Extensions.LanguageServer.Protocol;
45

56
namespace OmniSharp.Extensions.LanguageServer.Client.Protocol
67
{
78
/// <summary>
89
/// The server-side representation of an LSP message.
910
/// </summary>
10-
[JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))]
1111
public class ServerMessage
1212
{
1313
/// <summary>
@@ -18,7 +18,7 @@ public class ServerMessage
1818
/// <summary>
1919
/// The request / response Id, if the message represents a request or a response.
2020
/// </summary>
21-
[JsonProperty(DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
21+
[Optional]
2222
public object Id { get; set; }
2323

2424
/// <summary>
@@ -29,13 +29,13 @@ public class ServerMessage
2929
/// <summary>
3030
/// The request / notification message, if the message represents a request or a notification.
3131
/// </summary>
32-
[JsonProperty(DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
32+
[Optional]
3333
public JObject Params { get; set; }
3434

3535
/// <summary>
3636
/// The response message, if the message represents a response.
3737
/// </summary>
38-
[JsonProperty(DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
38+
[Optional]
3939
public JObject Result { get; set; }
4040

4141
/// <summary>

src/JsonRpc/Client/Notification.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
namespace OmniSharp.Extensions.JsonRpc.Client
55
{
6-
[JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))]
76
public class Notification
87
{
98
public string ProtocolVersion { get; } = "2.0";
@@ -12,4 +11,4 @@ public class Notification
1211

1312
public object Params { get; set; }
1413
}
15-
}
14+
}

src/JsonRpc/Client/Request.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
namespace OmniSharp.Extensions.JsonRpc.Client
55
{
6-
[JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))]
76
public class Request
87
{
98
public object Id { get; set; }

src/JsonRpc/Client/Response.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
namespace OmniSharp.Extensions.JsonRpc.Client
55
{
6-
[JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))]
76
public class Response
87
{
98
public Response(object id)

src/JsonRpc/RpcError.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace OmniSharp.Extensions.JsonRpc
66
{
77

8-
[JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy)), JsonConverter(typeof(RpcErrorConverter))]
8+
[JsonConverter(typeof(RpcErrorConverter))]
99
public class RpcError<T>
1010
{
1111
public RpcError(object id, ErrorMessage<T> message) : this(id, message, "2.0")

src/JsonRpc/Server/Messages/ErrorMessage.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ public ErrorMessage(int code, string message, object data) : base(code, message,
1515
}
1616
}
1717

18-
[JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))]
1918
public class ErrorMessage<T> : IErrorMessage
2019
{
2120
[JsonConstructor]

src/JsonRpc/Server/Notification.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace OmniSharp.Extensions.JsonRpc.Server
66
{
7-
[JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))]
87
public class Notification : IMethodWithParams
98
{
109
internal Notification(

src/JsonRpc/Server/Request.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace OmniSharp.Extensions.JsonRpc.Server
66
{
7-
[JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))]
87
public class Request : IMethodWithParams
98
{
109
internal Request(object id, string method, JToken @params) : this(id, method, @params, "2.0") { }

0 commit comments

Comments
 (0)