Skip to content

Commit 40de314

Browse files
movve to CodeAction
1 parent aa00910 commit 40de314

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

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

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
using System;
77
using System.Collections.Generic;
8+
using System.Linq;
89
using System.Threading;
910
using System.Threading.Tasks;
1011
using Microsoft.Extensions.Logging;
@@ -85,11 +86,16 @@ public async Task<CommandOrCodeActionContainer> Handle(CodeActionParams request,
8586
string diagnosticId = AnalysisService.GetUniqueIdFromDiagnostic(diagnostic);
8687
if (corrections.TryGetValue(diagnosticId, out MarkerCorrection correction))
8788
{
88-
codeActions.Add(new Command()
89+
90+
codeActions.Add(new CodeAction
8991
{
90-
Title = correction.Name,
91-
Name = "PowerShell.ApplyCodeActionEdits",
92-
Arguments = JArray.FromObject(correction.Edits)
92+
Kind = CodeActionKind.QuickFix,
93+
Command = new Command
94+
{
95+
Title = correction.Name,
96+
Name = "PowerShell.ApplyCodeActionEdits",
97+
Arguments = JArray.FromObject(correction.Edits)
98+
}
9399
});
94100
}
95101
}
@@ -107,13 +113,15 @@ public async Task<CommandOrCodeActionContainer> Handle(CodeActionParams request,
107113
{
108114
ruleNamesProcessed.Add(diagnostic.Code.String);
109115

110-
codeActions.Add(
111-
new Command
116+
codeActions.Add(new CodeAction
117+
{
118+
Command = new Command
112119
{
113120
Title = $"Show documentation for \"{diagnostic.Code}\"",
114121
Name = "PowerShell.ShowCodeActionDocumentation",
115122
Arguments = JArray.FromObject(new[] { diagnostic.Code })
116-
});
123+
}
124+
});
117125
}
118126
}
119127

0 commit comments

Comments
 (0)