javavscode
javavscode copied to clipboard
refactor.extract code actions are not available
If I try to trigger refactor.extract.variable with a keyboard shortcut I get:
But it is listed as refactoring here:
I first thought that this might be because a different code action is used, but the CodeActionKind.Extract[https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#codeActionKind] is part of the LSP spec. It is also listed under "Extract" in the menu.
Hey @fvclaus,
You can open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P on macOS) and search for "Preferences: Open Keyboard Shortcuts". Once there, try searching for "jdk" to check which commands are available with keyboard shortcuts.
As for Extract Variable, I don't believe there's a predefined keyboard shortcut for that at the moment in our extension. Let me know if I was able to understand your question correctly or not.
@Achal1607 I don't think this should be defined explicitly by the extension. The language server tells vscode its capabilities and if the RefactorAction is supported, the following shortcut should work:
{
"key": "ctrl+shift+r v",
"command": "editor.action.codeAction",
"args": {
"kind": "refactor.extract.variable"
}
}