Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion : contribute "extract variable" and "extract method" Code Action kinds #714

Closed
dlicois opened this issue Nov 14, 2018 · 4 comments
Assignees

Comments

@dlicois
Copy link

dlicois commented Nov 14, 2018

Hello,

vscode-java introduced "extract to variable" and "extract to method" refactoring as quick-fixes a while ago. #303 #459

However, the extension doesn't contribute Code Action kinds or commands, as the typescript extension does.

Code Action kinds are specified by extensions using the enhanced CodeActionProvided API

https://code.visualstudio.com/docs/editor/refactoring#_keybindings-for-code-actions

https://github.com/Microsoft/vscode/blob/758206be09ddfaac46e941a77375ec34ed928b4b/extensions/typescript-language-features/src/features/refactor.ts#L107

Adding "refactor.extract.function", "refactor.extract.constant" and "refactor.extract.variable" code action kinds would allow contribution to keybinds for direct "extract method" refactoring. Which would be useful for vscode-eclipse-keybindings extension (Alt+Shift+m and Alt+Shift+l keybinds).

@fbricon
Copy link
Collaborator

fbricon commented Nov 14, 2018

should be doable now that the server returns code actions. we need to adjust the code action kinds on the server side though.

@yaohaizh
Copy link
Collaborator

The server side already adjusted the code action for refactor.extract. Need update for organize import, the PR should be ready by the end of this week.

@fbricon
Copy link
Collaborator

fbricon commented Dec 18, 2018

@fbricon fbricon changed the title Suggestion : contribute "export variable" and "export method" Code Action kinds Suggestion : contribute "extract variable" and "extract method" Code Action kinds Dec 18, 2018
@fbricon fbricon closed this as completed Dec 18, 2018
@fbricon
Copy link
Collaborator

fbricon commented Dec 18, 2018

Key mappings can now point to

  • refactor.extract.function
  • refactor.extract.variable
  • refactor.extract.constant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants