Revamping to matrix style
This commit is contained in:
21
node_modules/yaml-language-server/lib/esm/languageserver/commandExecutor.js
generated
vendored
Normal file
21
node_modules/yaml-language-server/lib/esm/languageserver/commandExecutor.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Red Hat, Inc. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
export class CommandExecutor {
|
||||
constructor() {
|
||||
this.commands = new Map();
|
||||
}
|
||||
executeCommand(params) {
|
||||
if (this.commands.has(params.command)) {
|
||||
const handler = this.commands.get(params.command);
|
||||
return handler(...params.arguments);
|
||||
}
|
||||
throw new Error(`Command '${params.command}' not found`);
|
||||
}
|
||||
registerCommand(commandId, handler) {
|
||||
this.commands.set(commandId, handler);
|
||||
}
|
||||
}
|
||||
export const commandExecutor = new CommandExecutor();
|
||||
//# sourceMappingURL=commandExecutor.js.map
|
||||
Reference in New Issue
Block a user