-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Assign CodeAction Kind #2833
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
Comments
cc @SomeoneToIgnore, this seems(I haven’t read the spec yet) like it might actually cover the import use-case as well? |
I will try it again, but I was unable to get those actions to group by setting that property and enabling the support on the client and the server: |
@SomeoneToIgnore did you change the titles to unique things too? I would expect that to work but... the LSP isn't exactly obvious sometimes. |
At the very least this will give us keybinding support https://code.visualstudio.com/docs/editor/refactoring |
Here's what I get with different names and different kinds. If feels like changing supported actions and code action kinds does nothing, that's why I wonder what I miss. |
In VSCode if you hit the keybinding for refactoring (ctrl+shift+R) the UI should only return refactors. "ctrl+." should give you both refactors and quickfixes. We can actually use this information to ignore computing code assists on the server side too I think. There is also a kind that can apply all quick fixes to the file ( If you assign |
To summarize I think we should do the following:
For filtering (and eventually marking assists as 'non applicable' ie disabled) we should probably know our |
As an example: https://github.com/vshaxe/vshaxe/wiki/Code-Actions |
I was just playing with this and if we return the kinds from the server initialize request we get the refactor and code action menus showing up in vscode. Filling in the kind field also allows them to show up in the menus as those actions. |
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]>
In order to nicely support multiple code actions at a given location we need to fill in the kind field for each action in a hierarchical fashion.
See https://microsoft.github.io/language-server-protocol/specifications/specification-3-15/#textDocument_codeAction and
handle_code_action
in handlers.rsSee https://code.visualstudio.com/updates/v1_41#_codeactiondisabled which suggests we can append to the builtin strings?
The text was updated successfully, but these errors were encountered: