Skip to content

Commit

Permalink
Cleanup a few more instances of newtonsoft and warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
dibarbet committed May 3, 2024
1 parent 1a4c3f4 commit cade388
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 84 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ internal abstract partial class AbstractInProcLanguageClient(
AbstractLanguageClientMiddleLayer? middleLayer = null) : ILanguageClient, ILanguageServerFactory, ICapabilitiesProvider, ILanguageClientCustomMessage2
{
private readonly IThreadingContext _threadingContext = threadingContext;
#pragma warning disable CS0618 // Type or member is obsolete - blocked on Razor switching to new APIs for STJ - https://github.com/dotnet/roslyn/issues/73317
private readonly ILanguageClientMiddleLayer? _middleLayer = middleLayer;
#pragma warning restore CS0618 // Type or member is obsolete
private readonly ILspServiceLoggerFactory _lspLoggerFactory = lspLoggerFactory;
private readonly ExportProvider _exportProvider = exportProvider;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

Expand All @@ -9,11 +9,13 @@

namespace Microsoft.CodeAnalysis.Editor.Implementation.LanguageClient;

#pragma warning disable CS0618 // Type or member is obsolete - blocked on Razor switching to new APIs for STJ - https://github.com/dotnet/roslyn/issues/73317
internal abstract class AbstractLanguageClientMiddleLayer : ILanguageClientMiddleLayer
#pragma warning restore CS0618 // Type or member is obsolete
{
public abstract bool CanHandle(string methodName);

public abstract Task HandleNotificationAsync(string methodName, JToken methodParam, Func<JToken, Task> sendNotification);

public abstract Task<JToken?> HandleRequestAsync(string methodName, JToken methodParam, Func<JToken, Task<JToken?>> sendRequest);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// See the LICENSE file in the project root for more information.

using System.Collections.Immutable;
using Newtonsoft.Json;
using System.Text.Json.Serialization;
using LSP = Roslyn.LanguageServer.Protocol;

namespace Microsoft.CodeAnalysis.LanguageServer.Handler.CodeActions
Expand Down Expand Up @@ -33,10 +33,10 @@ internal class CodeActionResolveData

public string[] CodeActionPath { get; }

[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string[]? FixAllFlavors { get; }

[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ImmutableArray<LSP.CodeAction>? NestedCodeActions { get; }

public CodeActionResolveData(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Runtime.Serialization;
using Newtonsoft.Json;
using System.Text.Json.Serialization;
using Roslyn.LanguageServer.Protocol;

namespace Microsoft.CodeAnalysis.LanguageServer.Handler.CodeActions;

[DataContract]
internal sealed class RoslynFixAllCodeAction(string scope) : CodeAction
{
[JsonProperty(PropertyName = "scope")]
[JsonPropertyName("scope")]
public string Scope { get; } = scope;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using Roslyn.LanguageServer.Protocol;
using Newtonsoft.Json.Linq;

namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Configuration
{
Expand All @@ -15,7 +15,7 @@ public async Task OnInitializedAsync(ClientCapabilities clientCapabilities, Requ
{
if (clientCapabilities?.Workspace?.DidChangeConfiguration?.DynamicRegistration is true)
{
await _clientLanguageServerManager.SendRequestAsync<RegistrationParams, JObject>(
await _clientLanguageServerManager.SendRequestAsync<RegistrationParams, JsonElement>(
methodName: Methods.ClientRegisterCapabilityName,
@params: new RegistrationParams()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
// See the LICENSE file in the project root for more information.

using System.Text.Json.Serialization;
using Newtonsoft.Json;

namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Testing;

internal record RunTestsPartialResult(
[property: JsonPropertyName("stage")] string Stage,
[property: JsonPropertyName("message")] string Message,
[property: JsonPropertyName("progress"), JsonProperty(NullValueHandling = NullValueHandling.Ignore)] TestProgress? Progress
[property: JsonPropertyName("progress"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] TestProgress? Progress
);

This file was deleted.

This file was deleted.

0 comments on commit cade388

Please sign in to comment.