-
Notifications
You must be signed in to change notification settings - Fork 1
Enhance command registration #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,33 @@ | ||||||||||||||||||
| import * as vscode from "vscode"; | ||||||||||||||||||
|
|
||||||||||||||||||
| /** | ||||||||||||||||||
| * Defines the structure for registering commands. | ||||||||||||||||||
| */ | ||||||||||||||||||
| export interface CommandRegistration { | ||||||||||||||||||
| /** | ||||||||||||||||||
| * The command ID, corresponding to those defined in package.json | ||||||||||||||||||
| * | ||||||||||||||||||
| * @type {keyof Commands} | ||||||||||||||||||
| */ | ||||||||||||||||||
| command: keyof Commands; | ||||||||||||||||||
yCodeTech marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||
|
|
||||||||||||||||||
| /** | ||||||||||||||||||
| * The command handler function. | ||||||||||||||||||
| * | ||||||||||||||||||
| * The parameters are passed to the handler automatically by VS Code when the | ||||||||||||||||||
| * command is executed. | ||||||||||||||||||
| * | ||||||||||||||||||
| * @param textEditor The text editor | ||||||||||||||||||
| * @param edit The text editor edits. Optional because some commands may not need it. | ||||||||||||||||||
| * @returns void | ||||||||||||||||||
| */ | ||||||||||||||||||
| handler: (textEditor: vscode.TextEditor, edit?: vscode.TextEditorEdit) => void; | ||||||||||||||||||
|
Comment on lines
+21
to
+24
|
||||||||||||||||||
| * @param edit The text editor edits. Optional because some commands may not need it. | |
| * @returns void | |
| */ | |
| handler: (textEditor: vscode.TextEditor, edit?: vscode.TextEditorEdit) => void; | |
| * @param edit The text editor edits. Always provided by VS Code, though some commands may not use it. | |
| * @returns void | |
| */ | |
| handler: (textEditor: vscode.TextEditor, edit: vscode.TextEditorEdit) => void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
handleChangeBladeMultiLineBlockmethod (line 958 in src/configuration.ts) only accepts one parameter(textEditor: vscode.TextEditor), butregisterTextEditorCommandalways provides both textEditor and edit parameters. While JavaScript will ignore the extra parameter, this creates a signature mismatch with theCommandRegistration.handlerinterface. The handler should accept the edit parameter even if it doesn't use it, for consistency and to match the VS Code API contract:(textEditor: vscode.TextEditor, edit: vscode.TextEditorEdit) => void.