Skip to content

Commit

Permalink
Use the LspSerializer in CodeActions and SendTelemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
andyleejordan committed Nov 29, 2022
1 parent 5ce62d8 commit 93286ff
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ public async Task<CodeLens> ResolveCodeLens(
Title = GetReferenceCountHeader(referenceLocations.Length),
Arguments = JArray.FromObject(new object[]
{
scriptFile.DocumentUri,
codeLens.Range.Start,
referenceLocations
scriptFile.DocumentUri,
codeLens.Range.Start,
referenceLocations
},
LspSerializer.Instance.JsonSerializer)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using Microsoft.Extensions.Logging;
using Microsoft.PowerShell.EditorServices.Services;
using Microsoft.PowerShell.EditorServices.Services.TextDocument;
using Microsoft.PowerShell.EditorServices.Utility;
using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities;
using OmniSharp.Extensions.LanguageServer.Protocol.Document;
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;

namespace Microsoft.PowerShell.EditorServices.Handlers
{
Expand Down Expand Up @@ -131,7 +133,11 @@ public override async Task<CommandOrCodeActionContainer> Handle(CodeActionParams
{
Title = title,
Name = "PowerShell.ShowCodeActionDocumentation",
Arguments = Newtonsoft.Json.Linq.JArray.FromObject(new[] { diagnostic.Code?.String })
Arguments = JArray.FromObject(new object[]
{
diagnostic.Code?.String
},
LspSerializer.Instance.JsonSerializer)
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Microsoft.PowerShell.EditorServices.Services.Configuration;
using Newtonsoft.Json.Linq;
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;
using OmniSharp.Extensions.LanguageServer.Protocol.Server;
using OmniSharp.Extensions.LanguageServer.Protocol.Window;
using OmniSharp.Extensions.LanguageServer.Protocol.Workspace;
Expand Down Expand Up @@ -158,7 +159,7 @@ private void SendFeatureChangesTelemetry(LanguageServerSettingsWrapper incomingS
ExtensionData = new PsesTelemetryEvent
{
EventName = "NonDefaultPsesFeatureConfiguration",
Data = JObject.FromObject(configChanges)
Data = JObject.FromObject(configChanges, LspSerializer.Instance.JsonSerializer)
}
});
}
Expand Down

0 comments on commit 93286ff

Please sign in to comment.