fannheyward / coc-rust-analyzer

rust-analyzer extension for coc.nvim
MIT License
1.13k stars 40 forks source link

rust analyzer fail to start #1098

Closed darzok0914 closed 1 year ago

darzok0914 commented 1 year ago

this is a follow up of https://github.com/fannheyward/coc-rust-analyzer/issues/1094 as it has been closed but the issue remains.

When I open a rust file I get the message:

[coc.nvim] rust analyzer failed to start, run :CoCCommand reload.workspace to reload

So I still think that I need to build from source however I still have the issue described in the previous issue

I also wanted to thank you for your work, help and contribution to the community

fannheyward commented 1 year ago

Thank you for your report.

Can you help me to run node -e "console.log(process.arch, process.platform)" in your Linux? Maybe coc-rust-analyzer download invalid rust-analyzer for you.

You can also build from source or download rust-analyzer from https://github.com/rust-lang/rust-analyzer/releases, and set rust-analyzer.server.path to it.

darzok0914 commented 1 year ago

hi,

 ➜ ~ node -e "console.log(process.arch, process.platform)"
arm64 linux 

I already tried to build from source, that was the issue I reported in my 1st ticket but let me give you the details again here :)

when I build from source this is the message I have

yarn install v1.22.19
warning ../../package.json: No license field
[1/5] Validating package.json...
warning coc-rust-analyzer@0.71.0: The engine "coc" appears to be invalid.
[2/5] Resolving packages...
[3/5] Fetching packages...
[4/5] Linking dependencies...
warning " > coc.nvim@0.0.82" has incorrect peer dependency "@types/node@^12.12.0".
[5/5] Building fresh packages...
$ node esbuild.js
Done in 9.97s.
Ben@ori ➜ coc-rust-analyzer ( master) yarn lint
yarn run v1.22.19
warning ../../package.json: No license field
warning coc-rust-analyzer@0.71.0: The engine "coc" appears to be invalid.
$ eslint src --ext ts
Done in 0.93s.

I'm not quite sure I understand the warning about coc

I'll try to reinstall from source again and see if the issue is gone, I'll let you know :)

oren0e commented 1 year ago

Was this issue solved? I get the same error now

fannheyward commented 1 year ago

@oren0e what's your rust-analyzer version?

oren0e commented 1 year ago

well, I know I have it, but in the command line this rust-analyzer --version does not work. I know I have it because I see it in rustup component list, Also despite that message at the start when I start vim, I get autocompletion etc. My coc-rust-analyzer version is 0.73.0

fannheyward commented 1 year ago

@oren0e it's langserver issue, your rust-analyzer failed to start. We need more info about how do you install rust-analyzer? coc-rust-analyzer will download it from GitHub to ~/.config/coc/extensions/coc-rust-analyzer-data/rust-analyzer, does it exists? what's the output of ~/.config/coc/extensions/coc-rust-analyzer-data/rust-analyzer --version?

oren0e commented 1 year ago

@fannheyward sorry, yes that exists. I install it through coc, usually what happens is that when I open a rust file it will ask me if I want to update to a new version and that's how I do it. The output is:

rust-analyzer 0.3.1541-standalone (2f1b7cedc 2023-06-04)

I'm on a mac Big Sur (not M1)

fannheyward commented 1 year ago

@oren0e the output is updated, you're using the latest rust-analyzer release. This means rust-analyzer is working.

coc-rust-analyzer displayed rust-analyzer failed to start is because rust-analyzer response experimental/serverStatus with errors.

Try "rust-analyzer.trace.server": "verbose", restart to open a rust file, then :CocCommand workspace.showOutput rust-analyzer open the logs, search serverStatus, you should get something like this:

[Trace - 17:18:11.550] Received notification 'experimental/serverStatus'.
Params: {
    "health": "ok",
    "quiescent": true,
    "message": null
}
oren0e commented 1 year ago

Thanks, it now works without issues. I think what solved it is that I specifically ran again rustup component add rust-analyzer but this is the first time I had to do such a thing, even when it's a new project.