fannheyward / coc-rust-analyzer

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

[coc.nvim] Error on activate extension coc-rust-analyzer: bin.startsWith is not a function #1029

Closed kcubeterm closed 2 years ago

kcubeterm commented 2 years ago

What's the output of :CocInfo

versions

vim version: NVIM v0.7.2 node version: v18.4.0 coc.nvim version: 0.0.81-2522eee5 2022-06-14 19:03:29 +0800 coc.nvim directory: /data/data/com.termux/files/home/.nvim_plug/coc.nvim term: xterm-256color platform: android

Log of coc.nvim

                                                            2022-08-06T19:58:55.399 INFO (pid:12037) [plugin] - coc.nvim initialized with node: v18.4.0 after 958ms                         2022-08-06T19:58:55.412 ERROR (pid:12037) [extensions] - Error on active extension coc-rust-analyzer: bin.startsWith is not a function TypeError: bin.startsWith is not a function                  at Ctx2.resolveBin (/data/data/com.termux/files/home/.config/coc/extensions/node_modules/coc-rust-analyzer/lib/index.js:10755:15)                                                               at Object.activate (/data/data/com.termux/files/home/.config/coc/extensions/node_modules/coc-rust-analyzer/lib/index.js:11542:19)
at /data/data/com.termux/files/home/.nvim_plug/coc.nvim/build/index.js:273:1442                                                 at new Promise (<anonymous>)
at Object.activate (/data/data/com.termux/files/home/.nvim_plug/coc.nvim/build/index.js:273:1400)
at q_.activate (/data/data/com.termux/files/home/.nvim_plug/coc.nvim/build/index.js:270:7448)
at /data/data/com.termux/files/home/.nvim_plug/coc.nvim/build/index.js:272:199
at new Promise (<anonymous>)
at s (/data/data/com.termux/files/home/.nvim_plug/coc.nvim/build/index.js:272:68)
at q_.setupActiveEvents (/data/data/com.termux/files/home/.nvim_plug/coc.nvim/build/index.js:273:143)

2022-08-06T20:02:12.002 INFO (pid:12037) [attach] - receive notification: showInfo [] What's the output of :CocCommand rust-analyzer.serverVersion

[coc.nvim] Error on notification "runCommand": Command: rust-analyzer.serverVersion not found

kcubeterm commented 2 years ago

Additional info:

~$ rust-analyzer --version
rust-analyzer ???????
~ $ apt show rust-analyzer
Package: rust-analyzer
Version: 20220124
Maintainer: @termux
Installed-Size: 23.4 MB
Homepage: https://github.com/rust-analyzer/rust-analyzer
Download-Size: 4632 kB
APT-Manual-Installed: no
APT-Sources: https://dl.kcubeterm.com/termux-main stable/main aarch64 Packages
Description: A Rust compiler front-end for IDEs

rust-analyzer itself doesn't show e version but apt show it is 20220124

fannheyward commented 2 years ago

Do you set rust-analyzer.server.path in your coc-settings.json? What's the value?

kcubeterm commented 2 years ago
cat coc-settings.json
{
          "rust-analyzer.server.path": {
    "type": [
      "null",
      "string"
    ],
    "default": "/data/data/com.termux/files/usr/bin/rust-analyzer",
    "markdownDescription": "Path to rust-analyzer executable (points to bundled binary by default). If this is set, then \"rust-analyzer.updates.channel\" setting is not used"
  }
}

Default path is correct!

$ which rust-analyzer
/data/data/com.termux/files/usr/bin/rust-analyzer
fannheyward commented 2 years ago

Your rust-analyzer.server.path in coc-settings.json is incorrect, it should b a string value. You can leave it empty, or set the real path of rust-analyzer to it.

kcubeterm commented 2 years ago

Thanks, Now I got it.