question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Rust Analyzer is not found", with correct minimal coc-settings.json

See original GitHub issue

Env:

  • macOS 10.15.4
  • nvim v0.5.0-503-g9816173fb, also tried 0.4.3 stable from homebrew, same issue.
  • coc.nvim release branch
  • rust-analyzer compiled myself and located at $HOME/bin
  • I have a relatively minimal init.vim

coc-settings.json:

{
    "rust-analyzer.serverPath": "/Users/damien/bin/rust-analyzer"
}

The rust-analyzer plugin does not seem to be reading the settings file correctly. Each time I open a Rust file, I am prompted with:

Rust Analyzer is not found, download from GitHub release?:
1. Yes
2. Cancel
Type number and <Enter> or click with mouse (empty cancels):

If I pick 1, a new binary is downloaded, but the plugin never launches. Autocomplete, gd, etc. all do not work. Tailing the output of a logging wrapper (thanks @burntsushi) aroundrust-analyzer shows it is never called by the plugin.

Am I missing anything? How can I better debug why the plugin doesn’t respect the coc-settings config?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
rsignavongcommented, May 11, 2020

It works for me. I’ve cloned the rust-analyzer’s repository and then switch to release branch, then I build it with cd ~/LanguageServers/rust-analyzer && cargo xtask install --server. I see the rust-analyzer binary inside ~/.cargo/bin

Then my :CocConfig is just this.

{
  "coc.preferences.formatOnSaveFiletypes": [
    ...
    "rust",
    ...
  ],
  "diagnostic.errorSign": "✘",
  "diagnostic.infoSign": "i",
  "languageserver": {
    ...
    "rust": {
      "command": "rust-analyzer",
      "filetypes": ["rust"],
      "rootPatterns": ["Cargo.toml"]
    }
  }
}

Then when I open a Rust file, it loads the rust-analyzer. Sometimes, it asks to install the Rust-analyzer, and I answer 1. Yes but I don’t know if it does something different. Screenshot 2020-05-11 14 44 58

1reaction
semansercommented, Aug 30, 2020

I had the same issue. This coc-settings.json works for me:

"languageserver": {
    "rust": {
      "command": "rust-analyzer",
      "filetypes": ["rust"],
      "rootPatterns": ["Cargo.toml"]
    }
  }
Read more comments on GitHub >

github_iconTop Results From Across the Web

User Manual - rust-analyzer
If rust-analyzer is not detected, Corrosion will prompt you for configuration of your Rust toolchain and language server with a link to the...
Read more >
Looking for help with a vim/coc-rust-analyzer issue - Reddit
This is a new, fresh install of coc. nvim in Vim (not Neovim). No other CoC extensions have been installed. Only coc-rust-analyzer is...
Read more >
neoclide/coc.nvim - Gitter
I am having trouble with completion timing out on large projects. Completion works OK on small projects. My :messages show source rust-analyzer timeout...
Read more >
Hottest 'coc.nvim' Answers - Stack Overflow
In your coc-settings.json file write: { "diagnostic.checkCurrentLine": true } coc-settings.json can be found in ~/.vim/coc-settings.json OR in vim type ...
Read more >
coc-rust-analyzer/README.md - UNPKG
Settings not specific to `rust-analyzer` can be found at `:help coc-configuration`. 44. 45, ## Commands. 46.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found