Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Feat: Code action support #2021
Feat: Code action support #2021
Changes from 1 commit
071a50f
ca200df
b6b0e95
741174f
2f51467
caf2971
5495a40
e14f3ed
62b05c1
0526479
8530409
f6578d7
4fb9ac6
dff29f3
6e8b10b
2213f74
0a4bbd7
5c32824
6c24c17
1526720
9c8da89
459e67d
d781d01
410e571
d263cbf
1c6cb46
5240d50
2aaea69
815337f
4a4a99b
b4306d7
e015b0a
b45e006
e6aa3d2
9e270af
e11951f
0c57999
6ba73f3
05c3a2f
d9f32ce
82bc0ec
02cd82a
e8cb5bb
4f48b93
a5d767f
e9d574c
77e8085
29ab977
af8ac08
06421ea
c962e0e
274e314
b8199cc
92a029a
71a42f6
bba15f6
44da9fe
d66b4d2
5a1c545
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 think the intention of the CodeAction API is to use the field
command
oredit
to define what happens when a user triggers the action, so here you could haveInstead of the Data field
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'm not sure about what you mean.
The code that handles the code action is this one:
public override Task<CodeAction> Handle(CodeAction request...
, which explicitly requires an unresolved code action. So I don't understand why I should send a command?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'm saying you could return a CodeAction that includes a Command instead of one that includes Data, since this seems how the API is intended to be used. From the documentation:
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.
Looks like the documentation of the API is incomplete. Although what you say works well theoretically, it has the side-effect that it creates an error in VSCode.
![image](https://user-images.githubusercontent.com/3601079/184013417-27350a08-93bf-40e7-a1c9-b860ca8462b8.png)
And that's what I thought: Code actions can either give edits on the text or more general actions.
However, the API documentation you describe don't talk about the construction of code actions which is two phases, which I've seen while browing the code online
In 1) there is no need to create an edit or a command if all the edits and commands are going to be computed on 2.
As a conclusion, adding a "command" would require us to change the VSCode extension to support this command, which would have to manually invoke the code action resolver... which would be useless and hard to maintain
So I'm going to revert my changes there and just use the regular data field which is there for this purpose - the data between code action creation and code action resolution.
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.
That indeed seems bad.
OK, let's keep this as it is. Thanks for trying.