Reputation: 73
I'm writing a vscode extension which can run a particular subprocess and direct the output to an output channel. I'm adding a keybinding for the command to kill the subprocess if necessary.
I'd like to use ctrl+c, as one would do in a terminal, but only when the focus is in the output channel.
I did not see how I could specify this in the 'when' clause for my keybinding. Is it possible?
Upvotes: 0
Views: 971
Reputation: 1
If you want to check which output channel is selected, you can additionally query resourceExtname, e.g.:
{
"command": "MyApp.RefreshLogChannel",
"key": "f5",
"when": "focusedView == 'workbench.panel.output' && resourceExtname == '.myapp-#2-MyApp Log'"
}
To find out what's the resourceExtname of your output channel, you can do the following:
Upvotes: 0
Reputation: 330
You can check if the focusedView
is set to the output panel, like so:
{
"key": "ctrl+k",
"command": "workbench.output.action.clearOutput",
"when": "focusedView == 'workbench.panel.output'"
}
Upvotes: 4