Skip to content

Commit 1b3a8ed

Browse files
committed
Fix return value of EditorObject.RegisterCommand
This change fixes the EditorObject.RegisterCommand function to pass through the return value of the ExtensionService.RegisterCommand function so that the Register-EditorCommand cmdlet writes the correct verbose output depending on whether the command was already registered.
1 parent 3313968 commit 1b3a8ed

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,10 @@ public EditorObject(
5858
/// Registers a new command in the editor.
5959
/// </summary>
6060
/// <param name="editorCommand">The EditorCommand to be registered.</param>
61-
public void RegisterCommand(EditorCommand editorCommand)
61+
/// <returns>True if the command is newly registered, false if the command already exists.</returns>
62+
public bool RegisterCommand(EditorCommand editorCommand)
6263
{
63-
this.extensionService.RegisterCommand(editorCommand);
64+
return this.extensionService.RegisterCommand(editorCommand);
6465
}
6566

6667
/// <summary>

0 commit comments

Comments
 (0)