Skip to content

Move TS/JS to use organize imports codeAction instead of command#47850

Merged
mjbvz merged 4 commits intomicrosoft:masterfrom
mjbvz:organize-imports-codeaction-kind
Apr 18, 2018
Merged

Move TS/JS to use organize imports codeAction instead of command#47850
mjbvz merged 4 commits intomicrosoft:masterfrom
mjbvz:organize-imports-codeaction-kind

Conversation

@mjbvz
Copy link
Collaborator

@mjbvz mjbvz commented Apr 13, 2018

Fixes #47845
Fixes #46647

  • Defines a new standard SourceOrganizeImports CodeActionKind to be used to implement organize imports in a consistent way.
  • Add a new Organize imports command and keybinding that executes these actions.
  • Move over the existing js/ts organize imports command to use the new code action kind

@mjbvz mjbvz self-assigned this Apr 13, 2018
@mjbvz mjbvz requested a review from jrieken April 13, 2018 21:09
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have a more generic context key? We could use equality or the regex support. Something like supportedCodeAction ~= /source\.organizeImports.*/

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. supportedCodeAction is a space separated list of provided kinds. The regexp you use will typically look like:

/\bsource\.organizeImports(\b|\.)/

Which will match source.organizeImports as well as source.organizeImports.alphabetically

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please document the actual value

@mjbvz mjbvz force-pushed the organize-imports-codeaction-kind branch from 555413d to fc0c499 Compare April 17, 2018 18:02
mjbvz added 3 commits April 17, 2018 16:30
Fixes microsoft#47845
Fixes microsoft#46647

- Defines a new standard `SourceOrganizeImports` `CodeActionKind` to be used to implement organize imports in a consistent way.
- Add a new `Organize imports` command and keybinding that executes these actions.
- Move over the existing js/ts organize imports command to use the new code action kind
@mjbvz mjbvz force-pushed the organize-imports-codeaction-kind branch from 3b97519 to 378c760 Compare April 17, 2018 23:32
Copy link
Member

@jrieken jrieken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Make sure we only match whole scopes and not `unicorn.source.organizeImports`
@mjbvz mjbvz added this to the April 2018 milestone Apr 18, 2018
@mjbvz mjbvz merged commit 2fadb90 into microsoft:master Apr 18, 2018
@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Define standard OrganizeImports CodeActionKind Organise imports should be a refactoring/code action

2 participants