-
Notifications
You must be signed in to change notification settings - Fork 336
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
Add support for code action literal as a return value of the textDocument/codeAction request #350
Conversation
types/src/main.ts
Outdated
* Actions not of this kind are filtered out by the client before being shown. So servers | ||
* can omit computing them. | ||
*/ | ||
only?: CodeActionKind |
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.
Why isn't this a CodeActionKind[]
so that the client can request two separate kinds of code actions? What if I don't want quickfix
but I want both refactor
and source
?
Good point. Agree to change this. |
VCodeActionKind.RefactorInline.value!, | ||
VCodeActionKind.RefactorRewrite.value!, | ||
VCodeActionKind.Source.value!, | ||
VCodeActionKind.SourceOrganizeImports.value! |
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.
Wouldn't it make more sense to use CodeActionKind
from the language server protocol instead of using the VS Code one? That sounds a lot safer and is more agnostic since then we're only using stuff that the protocol explicitly declares.
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.
Agree. Will change it.
/** | ||
* A set of predefined code action kinds | ||
*/ | ||
export namespace CodeActionKind { |
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.
There is no Empty
type but VS Code does have one. Is this intentional?
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.
I though that this is not necessary in the LSP since we can simply use the empty string. In VSCode it is a class with a private constructor hence you can only make new kinds by starting with Empty and then append. Since we have literals I felt this is overkill and left it out.
cap.codeActionLiteralSupport = { | ||
codeActionKind: { | ||
valueSet: [ | ||
VCodeActionKind.Empty.value!, |
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.
The protocol doesn't have a CodeActionKind.Empty
declared. Is this an issue? See below.
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.
See above.
No description provided.