Skip to content

Keybinding for applying a specific code action  #33049

@mjbvz

Description

@mjbvz

Problem
Some code actions, such as extract method, may be used very often. This currently requires too many steps:

  1. Highlight expression to be extracted
  2. Use editor.action.quickFix shortcut
  3. Select Extract method from list of quick fixes and press enter.

Desired Flow
User creates a keybinding:

{
    "key": "cmd+r,m",
    "command": "editor.action.applyQuickFix",
    "arguments": ["extract"]
}
  1. Highlight expression to be extracted
  2. Press ctrl+r, m

Complications

  1. Multiple extract method options may exist. In this case, I think we'd want to display a list of all possible extract code actions

  2. Ideally the same shortcuts should work across languages

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions