-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
I get "Extract into variable" assist but not "Extract into function" #11577
Comments
That's really weird. I get the same results as in VSCode with Emacs. At first I thought it might be related to the experimental snippet capability, but the extract function assist should still work without it. Also, that would not explain why you get the extract variable assist. Can you try getting code actions in a few more places? For example selecting the Also, can you try actually applying the |
Ah, I can reproduce this for files that are not part of the module tree. Are you testing in a new cargo project? It seems like This probably works in VSCode because of the detached files support, which currently requires custom initialization options that only the VSCode plugin provides. |
yup that's it, it works inside a project.
that sounds cool and scary at the same time
I didn't get anything on hover, likely because of the missing project setup. |
Your code snippet works for me in Neovim (using rustaceanvim) with rust-analyzer v2024-08-19: fn main() {
let n = 100;
for i in 0..n {
println!("{}", i);
}
} However, if I add #[tokio::main]
async fn main() {
let n = 100;
for i in 0..n {
println!("{}", i);
}
} |
The VSCode extension provides "Extract into function" as expected, but when using another client (kak-lsp) I merely get "Extract into variable".
The VSCode extension and kak-lsp have a number of differences in capabilities, but I didn't see anything relevant.
I made both clients use this binary:
Reproducible with this Rust file:
Initialization looks like this
when I select lines 3-5 (the for loop) and ask for code actions I get "Extract into variable" instead of "Extract into function"
Originally reported in kakoune-lsp/kakoune-lsp#594
The text was updated successfully, but these errors were encountered: