-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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
Move TS/JS to use organize imports codeAction instead of command #47850
Move TS/JS to use organize imports codeAction instead of command #47850
Conversation
@@ -19,6 +19,7 @@ import { CodeActionKind, CodeActionTrigger } from './codeActionTrigger'; | |||
|
|||
export const HAS_REFACTOR_PROVIDER = new RawContextKey<boolean>('hasRefactorProvider', false); | |||
export const HAS_SOURCE_ACTION_PROVIDER = new RawContextKey<boolean>('hasSourceActionProvider', false); | |||
export const HAS_ORGANIZE_IMPORTS_PROVIDER = new RawContextKey<boolean>('hasOrganizeImportsActionProvider', false); |
There was a problem hiding this comment.
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.*/
There was a problem hiding this comment.
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
src/vs/vscode.d.ts
Outdated
@@ -1942,6 +1942,11 @@ declare module 'vscode' { | |||
*/ | |||
static readonly Source: CodeActionKind; | |||
|
|||
/** | |||
* Base kind for an organize imports source action. |
There was a problem hiding this comment.
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
555413d
to
fc0c499
Compare
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
3b97519
to
378c760
Compare
There was a problem hiding this 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`
Fixes #47845
Fixes #46647
SourceOrganizeImports
CodeActionKind
to be used to implement organize imports in a consistent way.Organize imports
command and keybinding that executes these actions.