Skip to content

Commit b10db0c

Browse files
committed
Several tweaks to InvokeExtension commands to allow passing key-value (string,string) based parameters
1 parent d5f83cf commit b10db0c

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

src/PowerShellEditorServices.Protocol/LanguageServer/EditorCommands.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public static readonly
5454

5555
public string Name { get; set; }
5656

57+
public System.Collections.Generic.Dictionary<string,string> Parameter{ get; set; }
5758
public ClientEditorContext Context { get; set; }
5859
}
5960

src/PowerShellEditorServices.Protocol/Server/LanguageServer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ private Task HandleInvokeExtensionCommandRequest(
347347
Task commandTask =
348348
this.editorSession.ExtensionService.InvokeCommand(
349349
commandDetails.Name,
350-
editorContext);
350+
editorContext, commandDetails.Parameter);
351351

352352
commandTask.ContinueWith(t =>
353353
{

src/PowerShellEditorServices/Extensions/ExtensionService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public async Task Initialize(
9797
/// <param name="commandName">The unique name of the command to be invoked.</param>
9898
/// <param name="editorContext">The context in which the command is being invoked.</param>
9999
/// <returns>A Task that can be awaited for completion.</returns>
100-
public async Task InvokeCommand(string commandName, EditorContext editorContext)
100+
public async Task InvokeCommand(string commandName, EditorContext editorContext, Dictionary<string,string> parameter)
101101
{
102102
EditorCommand editorCommand;
103103

@@ -106,7 +106,7 @@ public async Task InvokeCommand(string commandName, EditorContext editorContext)
106106
PSCommand executeCommand = new PSCommand();
107107
executeCommand.AddCommand("Invoke-Command");
108108
executeCommand.AddParameter("ScriptBlock", editorCommand.ScriptBlock);
109-
executeCommand.AddParameter("ArgumentList", new object[] { editorContext });
109+
executeCommand.AddParameter("ArgumentList", new object[] { editorContext,parameter });
110110

111111
await this.PowerShellContext.ExecuteCommand<object>(
112112
executeCommand,

0 commit comments

Comments
 (0)