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

Add support for code action literal as a return value of the textDocument/codeAction request #350

Merged
merged 5 commits into from
Jun 4, 2018

Conversation

dbaeumer
Copy link
Member

No description provided.

* Actions not of this kind are filtered out by the client before being shown. So servers
* can omit computing them.
*/
only?: CodeActionKind
Copy link
Contributor

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?

@dbaeumer
Copy link
Member Author

Good point. Agree to change this.

VCodeActionKind.RefactorInline.value!,
VCodeActionKind.RefactorRewrite.value!,
VCodeActionKind.Source.value!,
VCodeActionKind.SourceOrganizeImports.value!
Copy link
Contributor

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.

Copy link
Member Author

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 {
Copy link
Contributor

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?

Copy link
Member Author

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!,
Copy link
Contributor

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

See above.

@dbaeumer dbaeumer merged commit 643ef2c into master Jun 4, 2018
dbaeumer added a commit that referenced this pull request Jun 4, 2018
@dbaeumer dbaeumer deleted the dbaeumer/codeAction branch January 9, 2023 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants