Skip to content

Code actions of kind 'quickfix 'requested but returned code action is of kind 'refactor.extract.variable'. #4211

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

Open
lnicola opened this issue Apr 29, 2020 · 8 comments
Labels
A-assists S-actionable Someone could pick this issue up and work on it right now

Comments

@lnicola
Copy link
Member

lnicola commented Apr 29, 2020

Spotted in the extension host log channel:

[2020-04-29 20:23:07.209] [exthost] [warning] matklad.rust-analyzer - Code actions of kind 'quickfix 'requested but returned code action is of kind 'refactor.extract.variable'. Code action will be dropped. Please check 'CodeActionContext.only' to only return requested code actions.
@kjeremy
Copy link
Contributor

kjeremy commented Apr 29, 2020

Oh interesting vscode must send the context down now with the only flag filled in (maybe this is diagnostic related?). I'm a little surprised that this kicked in without #4167 since we only report the support of Command[] (though in practice we return CodeAction[]).

@kjeremy
Copy link
Contributor

kjeremy commented Apr 29, 2020

I think this may be a bug in vscode or vscode-languageclient

@FraGag
Copy link

FraGag commented Jun 16, 2020

I've seen a similar message but in a different context. If this doesn't belong in this issue, please tell me and I'll post a new issue.

In settings.json, I have:

{
    "editor.codeActionsOnSave": [
        "editor.action.formatDocument"
    ]
}

This causes VSCode to reformat a document before saving it.

The exact message I'm getting is this:

[2020-06-16 14:39:49.575] [exthost] [warning] matklad.rust-analyzer - Code actions of kind 'editor.action.formatDocument 'requested but returned code action is of kind 'quickfix'. Code action will be dropped. Please check 'CodeActionContext.only' to only return requested code actions.

The message appears every time I save a document.

Also, I must mention that sometimes, when I save, VSCode shows a popup in the lower-right that says Getting code actions from "rust-analyzer" (see this issue for an example). Yet, when I run the editor.action.formatDocument command explicitly, it completes more quickly than when it runs automatically on save. If I clear out the editor.codeActionsOnSave setting, saving is instantaneous.

It looks like the rust-analyzer extension doesn't check for the kind of actions that is being requested and returns them all, and I suspect that this is what causes saving to be slow. In my project, the "Quick Fix..." command (Ctrl+.) often takes a few seconds to complete. If quickfix actions are not requested, rust-analyzer shouldn't spend time enumerating them unnecessarily!

I'm using rust-analyzer-0.2.207.

@kjeremy
Copy link
Contributor

kjeremy commented Jun 16, 2020

We do not categorize most code actions yet (though we advertise all of them) so we ignore the filter on the server and miss that optimization (you see the results of this delay). The client-side filters out any code actions not requested.

@lnicola
Copy link
Member Author

lnicola commented Jul 13, 2020

@kjeremy this might be fixed now?

@kjeremy
Copy link
Contributor

kjeremy commented Jul 13, 2020

The underlying issue hasn't changed so I don't expect it to be fixed. We now categorize our code actions but still do not filter them.

@lnicola lnicola added the S-actionable Someone could pick this issue up and work on it right now label Jan 25, 2021
@necauqua
Copy link

Not sure is this a duplicate or should I open a new issue, but for me the source.organizeImports action does not exist - keybind does nothing and when I added "editor.codeActionsOnSave":{"source.organizeImports": true} to my settings I got this in extension host log:

[2022-08-14 06:06:48.350] [exthost] [warning] rust-lang.rust-analyzer - Code actions of kind 'source.organizeImports 'requested but returned code action is of kind 'quickfix'. Code action will be dropped. Please check 'CodeActionContext.only' to only return requested code actions.
Details

The unusual part is that I'm on NixOS, but I see that you patch the binary, that's actually really cool, thanks for that! Using the bundled+patched one.

Extension version: v0.3.1162
The only rust-analyzer setting is "rust-analyzer.checkOnSave.command": "clippy"

VSCode about page:

Version: 1.70.0
Commit: da76f93349a72022ca4670c1b84860304616aaa2
Date: 2022-08-04T04:38:48.541Z
Electron: 18.3.5
Chromium: 100.0.4896.160
Node.js: 16.13.2
V8: 10.0.139.17-electron.0
OS: Linux x64 5.18.16-zen1

@ckken
Copy link

ckken commented May 6, 2024

same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-assists S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

No branches or pull requests

6 participants