Wenfang Du
Wenfang Du

Reputation: 11397

How to construct the `When` condition for joining terminals?

Command for joining terminals: workbench.action.terminal.joinInstance.

Necessary conditions I can think of:

  1. Terminal tabs are focused.
  2. Two or more terminals are selected in the terminal tabs.

The best I came up with is:

terminalProcessSupported && terminalTabsFocus && !terminalTabsSingularSelection

But the above is not the same as terminalTabsMultipleSelections (which doesn't exist).

Upvotes: 0

Views: 164

Answers (1)

Wenfang Du
Wenfang Du

Reputation: 11397

With this fix in place, it's now safe to use terminalProcessSupported && terminalTabsFocus instead.


The original answer:

According to Daniel Imms's comment:

We use internally to make it work in the context menu terminalProcessSupported && !terminalTabsSingularSelection

And the source code in this regard:

precondition: ContextKeyExpr.and(
  KEYBINDING_CONTEXT_TERMINAL_PROCESS_SUPPORTED,
  KEYBINDING_CONTEXT_TERMINAL_TABS_SINGULAR_SELECTION.toNegated(),
)

So for now, it's still best to use terminalProcessSupported && terminalTabsFocus && !terminalTabsSingularSelection.

Upvotes: 1

Related Questions