-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor PowerPagesChatParticipant and add CommandRegistry (#1050)
Co-authored-by: amitjoshi <[email protected]>
- Loading branch information
1 parent
6e9e863
commit 7246c08
Showing
2 changed files
with
41 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*/ | ||
|
||
import * as vscode from "vscode"; | ||
|
||
export interface Command { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
execute(request: any, stream: vscode.ChatResponseStream): Promise<any>; | ||
} | ||
|
||
export class CommandRegistry { | ||
private commands: { [key: string]: Command } = {}; | ||
|
||
register(commandName: string, command: Command) { | ||
this.commands[commandName] = command; | ||
} | ||
|
||
get(commandName: string): Command { | ||
return this.commands[commandName]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters