-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feat/delete-multiple-schemas
- Loading branch information
Showing
33 changed files
with
700 additions
and
184 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
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
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
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,8 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Red Hat, Inc. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
export enum YamlCommands { | ||
JUMP_TO_SCHEMA = 'jumpToSchema', | ||
} |
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,27 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Red Hat, Inc. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { ExecuteCommandParams } from 'vscode-languageserver'; | ||
|
||
export interface CommandHandler { | ||
(...args: unknown[]): void; | ||
} | ||
|
||
export class CommandExecutor { | ||
private commands = new Map<string, CommandHandler>(); | ||
executeCommand(params: ExecuteCommandParams): void { | ||
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: string, handler: CommandHandler): void { | ||
this.commands.set(commandId, handler); | ||
} | ||
} | ||
|
||
export const commandExecutor = new CommandExecutor(); |
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
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
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
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
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
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,19 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Red Hat, Inc. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { ExecuteCommandParams, Connection } from 'vscode-languageserver'; | ||
import { CommandExecutor } from '../commandExecutor'; | ||
|
||
export class WorkspaceHandlers { | ||
constructor(private readonly connection: Connection, private readonly commandExecutor: CommandExecutor) {} | ||
|
||
registerHandlers(): void { | ||
this.connection.onExecuteCommand((params) => this.executeCommand(params)); | ||
} | ||
|
||
private executeCommand(params: ExecuteCommandParams): void { | ||
return this.commandExecutor.executeCommand(params); | ||
} | ||
} |
Oops, something went wrong.