p42ai / js-assistant

120+ refactorings and code-assists for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=p42ai.refactor
MIT License
119 stars 7 forks source link

Let the user disable the custom keybindings in the extension config options #53

Closed AndreaPontrandolfo closed 1 year ago

AndreaPontrandolfo commented 1 year ago

Hi, is there a way to completely disable all of the extension custom keybindings, for people that don't want them? I noticed that some of these keybindings directly conflicts with the native VScode keybindings and i don't want to deal with this. This might be a dealbreaker for most people.

lgrammel commented 1 year ago

Thanks for letting me know!

Which OS are you using and which keybindings are conflicting with which native keybinding?

You can disable the keybindings in the keyboard shortcuts UI (search for codeAction), or by adding the following exclusions to keybindings.json (list is for MacOs, might be different on win/linux):

[
  {
    "key": "ctrl+cmd+r",
    "command": "-editor.action.codeAction",
    "when": "editorTextFocus && resourceExtname =~ /^(\\.js|\\.jsx|\\.cjs|\\.mjs|\\.ts|\\.tsx|\\.cts|\\.mts|\\.vue)$/"
  },
  {
    "key": "ctrl+alt+r",
    "command": "-editor.action.codeAction",
    "when": "false"
  },
  {
    "key": "ctrl+cmd+i",
    "command": "-editor.action.codeAction",
    "when": "editorTextFocus && resourceExtname =~ /^(\\.js|\\.jsx|\\.cjs|\\.mjs|\\.ts|\\.tsx|\\.cts|\\.mts|\\.vue)$/"
  },
  {
    "key": "ctrl+alt+i",
    "command": "-editor.action.codeAction",
    "when": "false"
  },
  {
    "key": "ctrl+shift+cmd+i",
    "command": "-editor.action.codeAction",
    "when": "editorTextFocus && resourceExtname =~ /^(\\.js|\\.jsx|\\.cjs|\\.mjs|\\.ts|\\.tsx|\\.cts|\\.mts|\\.vue)$/"
  },
  {
    "key": "ctrl+shift+alt+i",
    "command": "-editor.action.codeAction",
    "when": "false"
  },
  {
    "key": "ctrl+cmd+x",
    "command": "-editor.action.codeAction",
    "when": "editorTextFocus && resourceExtname =~ /^(\\.js|\\.jsx|\\.cjs|\\.mjs|\\.ts|\\.tsx|\\.cts|\\.mts|\\.vue)$/"
  },
  {
    "key": "ctrl+alt+x",
    "command": "-editor.action.codeAction",
    "when": "false"
  },
  {
    "key": "ctrl+cmd+v",
    "command": "-editor.action.codeAction",
    "when": "editorTextFocus && resourceExtname =~ /^(\\.js|\\.jsx|\\.cjs|\\.mjs|\\.ts|\\.tsx|\\.cts|\\.mts|\\.vue)$/"
  },
  {
    "key": "ctrl+alt+v",
    "command": "-editor.action.codeAction",
    "when": "false"
  },
  {
    "key": "ctrl+cmd+b",
    "command": "-editor.action.codeAction",
    "when": "editorTextFocus && resourceExtname =~ /^(\\.js|\\.jsx|\\.cjs|\\.mjs|\\.ts|\\.tsx|\\.cts|\\.mts|\\.vue)$/"
  },
  {
    "key": "ctrl+alt+b",
    "command": "-editor.action.codeAction",
    "when": "false"
  },
  {
    "key": "ctrl+cmd+m",
    "command": "-editor.action.codeAction",
    "when": "editorTextFocus && resourceExtname =~ /^(\\.js|\\.jsx|\\.cjs|\\.mjs|\\.ts|\\.tsx|\\.cts|\\.mts|\\.vue)$/"
  },
  {
    "key": "ctrl+alt+m",
    "command": "-editor.action.codeAction",
    "when": "false"
  },
  {
    "key": "ctrl+alt+up",
    "command": "-editor.action.codeAction",
    "when": "editorTextFocus && resourceExtname =~ /^(\\.js|\\.jsx|\\.cjs|\\.mjs|\\.ts|\\.tsx|\\.cts|\\.mts|\\.vue)$/"
  },
  {
    "key": "shift+alt+up",
    "command": "-editor.action.codeAction",
    "when": "false"
  },
  {
    "key": "ctrl+alt+down",
    "command": "-editor.action.codeAction",
    "when": "editorTextFocus && resourceExtname =~ /^(\\.js|\\.jsx|\\.cjs|\\.mjs|\\.ts|\\.tsx|\\.cts|\\.mts|\\.vue)$/"
  },
  {
    "key": "shift+alt+down",
    "command": "-editor.action.codeAction",
    "when": "false"
  },
  {
    "key": "ctrl+cmd+a",
    "command": "-editor.action.codeAction",
    "when": "editorTextFocus && resourceExtname =~ /^(\\.js|\\.jsx|\\.cjs|\\.mjs|\\.ts|\\.tsx|\\.cts|\\.mts|\\.vue)$/"
  },
  {
    "key": "ctrl+alt+a",
    "command": "-editor.action.codeAction",
    "when": "false"
  }
]
AndreaPontrandolfo commented 1 year ago

OS: Windows 10 Pro Conflicting keybindings: ALT + SHIFT + arrows (both UP and DOWN)

lgrammel commented 1 year ago

Thanks - I'll move those to non-conflicting bindings and see if I can refine how the code action menus are being invoked (e.g. through the command palette) for easier reconfiguration.

AndreaPontrandolfo commented 1 year ago

Great, i'll wait for the next release then!

lgrammel commented 1 year ago

I've just released v1.147.4, which changes the keyboard shortcuts for move up/down on Windows/Linux to Ctrl+Alt+U and Ctrl+Alt+J. Thanks again for the bug report!