add hw2
This commit is contained in:
		
							
								
								
									
										28
									
								
								node_modules/langium/lib/lsp/execute-command-handler.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								node_modules/langium/lib/lsp/execute-command-handler.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,28 @@ | ||||
| /****************************************************************************** | ||||
|  * Copyright 2022 TypeFox GmbH | ||||
|  * This program and the accompanying materials are made available under the | ||||
|  * terms of the MIT License, which is available in the project root. | ||||
|  ******************************************************************************/ | ||||
| import { CancellationToken } from '../utils/cancellation.js'; | ||||
| export class AbstractExecuteCommandHandler { | ||||
|     get commands() { | ||||
|         return Array.from(this.registeredCommands.keys()); | ||||
|     } | ||||
|     constructor() { | ||||
|         this.registeredCommands = new Map(); | ||||
|         this.registerCommands(this.createCommandAcceptor()); | ||||
|     } | ||||
|     async executeCommand(name, args, cancelToken = CancellationToken.None) { | ||||
|         const command = this.registeredCommands.get(name); | ||||
|         if (command) { | ||||
|             return command(args, cancelToken); | ||||
|         } | ||||
|         else { | ||||
|             return undefined; | ||||
|         } | ||||
|     } | ||||
|     createCommandAcceptor() { | ||||
|         return (name, execute) => this.registeredCommands.set(name, execute); | ||||
|     } | ||||
| } | ||||
| //# sourceMappingURL=execute-command-handler.js.map | ||||
		Reference in New Issue
	
	Block a user
	 nik
					nik