Skip to content

Add CodeActionKinds to assists and return them from server caps if the client supports it #4147

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

Closed
kjeremy opened this issue Apr 25, 2020 · 1 comment · Fixed by #5116
Closed

Comments

@kjeremy
Copy link
Contributor

kjeremy commented Apr 25, 2020

@matklad I think I wrote the following... but do you remember why we went this route instead of having an AssistKind that gets converted to a String or CodeActionKind in conv.rs?

https://github.com/rust-analyzer/rust-analyzer/blob/45832b990c7f291abe578dff3c460f4a1232f024/crates/rust-analyzer/src/main_loop/handlers.rs#L699-L703

@matklad
Copy link
Member

matklad commented Apr 25, 2020

I don’t :-)

Seems better to add a kind field to assist, though, unless we are going to add different kinds to most assists, the current soln seems ok enough

bors bot added a commit that referenced this issue May 1, 2020
4167: Filter out code actions if unsupported by the client and advertise our capabilities r=matklad a=kjeremy

This PR does three things:
1. If the client does not support `CodeActionKind` this will filter the results and only send `Command[]` back.
2. Correctly advertises to the client that the server supports `CodeActionKind`. This may cause clients to not request code actions if they are checking for the provider to be `true` (or implement LSP < 3.8) in the caps but I will fix that in a followup PR.
3. Marks most CodeActions as <strike>"refactor" so that they show up in the menu in vscode.</strike>`""`.

Part of #144
#4147 
#2833  

Co-authored-by: kjeremy <[email protected]>
@bors bors bot closed this as completed in f51b0cf Jul 3, 2020
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 a pull request may close this issue.

2 participants