Skip to content

Commit ec398a0

Browse files
kamilkosekdaviwil
authored andcommitted
Implement GetCommands() on $psEditor
1 parent 81e1d90 commit ec398a0

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

Diff for: src/PowerShellEditorServices/Extensions/EditorObject.cs

+8
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,14 @@ public void UnregisterCommand(string commandName)
9090
this.extensionService.UnregisterCommand(commandName);
9191
}
9292

93+
/// <summary>
94+
/// Returns all registered EditorCommands.
95+
/// </summary>
96+
/// <returns>An Array of all registered EditorCommands.</return>
97+
public EditorCommand[] GetCommands()
98+
{
99+
return this.extensionService.GetCommands();
100+
}
93101
/// <summary>
94102
/// Gets the EditorContext which contains the state of the editor
95103
/// at the time this method is invoked.

Diff for: src/PowerShellEditorServices/Extensions/ExtensionService.cs

+10
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,16 @@ public void UnregisterCommand(string commandName)
170170
}
171171
}
172172

173+
/// <summary>
174+
/// Returns all registered EditorCommands.
175+
/// </summary>
176+
/// <returns>An Array of all registered EditorCommands.</return>
177+
public EditorCommand[] GetCommands()
178+
{
179+
EditorCommand[] commands = new EditorCommand[this.editorCommands.Count];
180+
this.editorCommands.Values.CopyTo(commands,0);
181+
return commands;
182+
}
173183
#endregion
174184

175185
#region Events

0 commit comments

Comments
 (0)