ryuta46 / vscode-multi-command

Visual Studio Code Plugin named multi-command
MIT License
229 stars 14 forks source link

Incorrect keybindings appear in command palette when manual execution #53

Open Yarakashi-Kikohshi opened 2 years ago

Yarakashi-Kikohshi commented 2 years ago

Incorrect keybindings appear in command palette when manual execution

multicommand-commandPalette

I haven't defined such a keybinding. The command actually executed by the keybinding displayed here is sequence defined in multi-command.

To reproduce

To avoid the problem raised in # 16, the keybinding is defined as follows:

// keybindings.json
{
  "key": "alt+q",
  // ↑ This keybinding is displayed in command palette
  "command": "extension.multiCommand.execute",
  "args": {
    "command": "multiCommand.markdown.test"
  },
  "when": "editorTextFocus && editorLangId == markdown"
}

Keybindings for extension.multiCommand.execute are not defined.

To avoid this problem

This problem does not occur if you define the keybindings as follows:

// keybindings.json
{
  "key": "alt+q",
  "command": "multiCommand.markdown.test",
  "when": "editorTextFocus && editorLangId == markdown"
}

However, there are # 16 potential issues with this solution.

Alternatively, to really define keybinding for extension.multiCommand.execute. However, I don't want to define a keybinding because I think it's enough to call it from command palette.

Possible causes

VS Code misunderstands that even extension.multiCommand.execute including args defines a keybinding for extension.multiCommand.execute alone.

ryuta46 commented 2 years ago

I reproduced this. I have no idea to avoid this issue.

VS Code misunderstands that even extension.multiCommand.execute including args defines a keybinding for extension.multiCommand.execute alone.

I think so too.

Yarakashi-Kikohshi commented 2 years ago

There are two simple solutions.

First idea

Divide extension.multiCommand.execute into two commands.

Currently, the command has two features:

Of course, when divide the command into two, user may be confused.

Second idea

Accept this problem and do not mind if you see keybinding like that in command palette. If so, you need to write a note in README.