Skip to content
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

No code autocomplete #221

Closed
ovidius72 opened this issue Apr 29, 2020 · 8 comments
Closed

No code autocomplete #221

ovidius72 opened this issue Apr 29, 2020 · 8 comments

Comments

@ovidius72
Copy link

ovidius72 commented Apr 29, 2020

I'm trying to replace rls with rust-analyzer. I'm using coc and I've installed the extension coc-rust-analyzer. I've used rust-analyzer from the arch linux aur repository and the one downloaded by the extension but none of theme seems to work for me. There should be something wrong with my setup despite I'v followed the installation guide.

With coc-rls i see this:
rust-rls

but with coc-rust-analyzer (the rls extension removed) I only get the diagnostic but no completion suggestions:

rust-analyzer

I've tried to add these lines to coc-settings.json but with no luck.

{
  "diagnostic.enableHighlightLineNumber": true,
  "rust-analyzer.diagnostics.enable": true,
  "rust-analyzer.procMacro.enable": true,
  "rust-analyzer.cargo.loadOutDirsFromCheck": true,
  "rust-analyzer.trace.server": "verbose",
....
}

Is it supposed to provide auto completion suggestions ?
Is there anything I'm missing in my config ? Thanks.

@ovidius72 ovidius72 changed the title No autocompletin No auto completion Apr 29, 2020
@ovidius72 ovidius72 changed the title No auto completion No code autocomplete Apr 29, 2020
@oblitum
Copy link

oblitum commented Apr 30, 2020

@ovidius72 try to provide more detail taking coc.nvim issue template as a model: https://raw.githubusercontent.com/neoclide/coc.nvim/master/.github/ISSUE_TEMPLATE/bug_report.md. It's hard to have an idea without info.

@fannheyward
Copy link
Owner

Do you test with a single rust file or a project with Cargo.toml ?

@ovidius72
Copy link
Author

ovidius72 commented Apr 30, 2020

It's a project with cargo.toml file.
I did more tests and found this.
I've created a file user.rs under the src directory. Working on that file auto completion does not work until you go in the main.rs file and import it with mod user;. Doing that I can see that everything work just fine. So it seems that it only works if you use that module in the main.rs file, otherwise not.
Can you please test if this is the same for you ? thanks
I'm learning rust so it could be that I'm doing it wrong but I suppose that all .rs files should be detected by rust-analyzer.

@fannheyward
Copy link
Owner

You can test your code with VSCode+rust-analyzer to make sure it works or not.

@ovidius72
Copy link
Author

thanks @fannheyward It doesn't work in VSCode+ra . The same thing happens. I don't know if it is the wanted behavior but this has nothing to do with coc-rust-analyzer. If it is an issue, it is related to rust-analyzer itself.
Thanks.

@mcchrish
Copy link

mcchrish commented May 5, 2020

Had the same issue after upgrading the rust-analyzer binary to 2020-04-27. So I manually download and replace the installed binary to https://github.com/rust-analyzer/rust-analyzer/releases/tag/2020-04-20 and now works again.

@fannheyward is there an option to let this plugin choose which version of rust-analyzer to install? That would be handy in cases like downgrading to some version specially since rust-analyzer is not yet stable.

@fannheyward
Copy link
Owner

The latest release is 2020-05-04, you can test the new release.

@ovidius72
Copy link
Author

the problem is here I guess: rust-lang/rust-analyzer#4177

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants