You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The commands “Change Case…” remain accessible even if no text editor is active, for example, when the active tab document is a bitmap image. In this case, then the error message is
Cannot destructure property 'document' of 'editor' as it is undefined.
Possible solution:
Use when clause in “package.json“, in this clause, use the context property. In the extension code, set the value of this property to true of false using vscode.commands.executeCommand("setContext", state). To figure out the state, find out if a text editor is active, and, optionally, if it has selected text. Also, use menus > commandPalette in “package.json“, list your commands with the same when clause there.
Instead of vscode.commands.registerCommand, use vscode.commands.registerTextEditorCommand. It should be enough for all commands except "extension.changeCase.commands".
Use context.subscriptions.push for all disposable objects, first of all, for commands.
Thank you.
—SA
The text was updated successfully, but these errors were encountered:
V. 1.0.0:
The commands “Change Case…” remain accessible even if no text editor is active, for example, when the active tab document is a bitmap image. In this case, then the error message is
Possible solution:
Use
when
clause in “package.json“, in this clause, use the context property. In the extension code, set the value of this property totrue
offalse
usingvscode.commands.executeCommand("setContext", state)
. To figure out thestate
, find out if a text editor is active, and, optionally, if it has selected text. Also, usemenus
>commandPalette
in “package.json“, list your commands with the samewhen
clause there.Instead of
vscode.commands.registerCommand
, usevscode.commands.registerTextEditorCommand
. It should be enough for all commands except"extension.changeCase.commands"
.Use
context.subscriptions.push
for all disposable objects, first of all, for commands.Thank you.
—SA
The text was updated successfully, but these errors were encountered: