Skip to content

OrganizeImports CodeAction, how does it work #2419

Answered by ckipp01
mdbergmann asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks for the question @mdbergmann.

But it seems that Metals doesn't send such when the clients asks for available CodeActions.

So after the initialize comes in, Metals declares that it supports the organize imports code action here:

if (initializeParams.supportsCodeActionLiterals) {
capabilities.setCodeActionProvider(
new CodeActionOptions(
List(
CodeActionKind.QuickFix,
CodeActionKind.Refactor,
CodeActionKind.SourceOrganizeImports
).asJava
)
)
} else {
capabilities.setCodeActionProvider(true)
}

So …

Replies: 6 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by ckipp01
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@tgodzik
Comment options

Comment options

You must be logged in to vote
1 reply
@ckipp01
Comment options

Comment options

You must be logged in to vote
1 reply
@ckipp01
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants