Skip to content

Commit 142b7f4

Browse files
committed
Use the LspSerializer in CodeActions and SendTelemetry
1 parent 5ce62d8 commit 142b7f4

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

src/PowerShellEditorServices/Server/PsesDebugServer.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Microsoft Corporation.
1+
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

44
using System;
@@ -89,6 +89,8 @@ public async Task StartAsync()
8989
{
9090
// Start the host if not already started, and enable debug mode (required
9191
// for remote debugging).
92+
//
93+
// TODO: We might need to fill in HostStartOptions here.
9294
_startedPses = !await _psesHost.TryStartAsync(new HostStartOptions(), cancellationToken).ConfigureAwait(false);
9395
_psesHost.DebugContext.EnableDebugMode();
9496

src/PowerShellEditorServices/Services/CodeLens/ReferencesCodeLensProvider.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,9 @@ public async Task<CodeLens> ResolveCodeLens(
154154
Title = GetReferenceCountHeader(referenceLocations.Length),
155155
Arguments = JArray.FromObject(new object[]
156156
{
157-
scriptFile.DocumentUri,
158-
codeLens.Range.Start,
159-
referenceLocations
157+
scriptFile.DocumentUri,
158+
codeLens.Range.Start,
159+
referenceLocations
160160
},
161161
LspSerializer.Instance.JsonSerializer)
162162
}

src/PowerShellEditorServices/Services/TextDocument/Handlers/CodeActionHandler.cs

+7-1
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
using System.Collections.Generic;
66
using System.Threading;
77
using System.Threading.Tasks;
8+
using Newtonsoft.Json.Linq;
89
using Microsoft.Extensions.Logging;
910
using Microsoft.PowerShell.EditorServices.Services;
1011
using Microsoft.PowerShell.EditorServices.Services.TextDocument;
1112
using Microsoft.PowerShell.EditorServices.Utility;
1213
using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities;
1314
using OmniSharp.Extensions.LanguageServer.Protocol.Document;
1415
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
16+
using OmniSharp.Extensions.LanguageServer.Protocol.Serialization;
1517

1618
namespace Microsoft.PowerShell.EditorServices.Handlers
1719
{
@@ -131,7 +133,11 @@ public override async Task<CommandOrCodeActionContainer> Handle(CodeActionParams
131133
{
132134
Title = title,
133135
Name = "PowerShell.ShowCodeActionDocumentation",
134-
Arguments = Newtonsoft.Json.Linq.JArray.FromObject(new[] { diagnostic.Code?.String })
136+
Arguments = JArray.FromObject(new object[]
137+
{
138+
diagnostic.Code?.String
139+
},
140+
LspSerializer.Instance.JsonSerializer)
135141
}
136142
});
137143
}

src/PowerShellEditorServices/Services/Workspace/WorkspaceService.cs

+1
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,7 @@ internal static bool IsPathInMemory(string filePath)
506506

507507
internal string ResolveRelativeScriptPath(string baseFilePath, string relativePath)
508508
{
509+
// TODO: Sometimes the `baseFilePath` (even when its `WorkspacePath`) is null.
509510
string combinedPath = null;
510511
Exception resolveException = null;
511512

0 commit comments

Comments
 (0)