fannheyward / coc-rust-analyzer

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

Inlay hints doesn't work for me #987

Closed yingmanwumen closed 2 years ago

yingmanwumen commented 2 years ago

What's the output of :CocInfo

## versions

vim version: NVIM v0.6.1
node version: v17.7.2
coc.nvim version: 0.0.80-0480cbd997
coc.nvim directory: /home/yingmanwumen/.config/nvim/pack/coc.nvim/start/coc.nvim
term: alacritty
platform: linux

## Log of coc.nvim

2022-05-13T10:59:18.182 INFO (pid:90347) [services] - registered service "highlight"
2022-05-13T10:59:18.206 INFO (pid:90347) [services] - registered service "rust-analyzer"
2022-05-13T10:59:18.207 INFO (pid:90347) [services] - Rust Analyzer Language Server state change:
→stopped => starting
2022-05-13T10:59:18.266 INFO (pid:90347) [plugin] - coc.nvim 0.0.80-0480cbd997 initialized with node: v17.7.2 after 254ms
2022-05-13T10:59:18.289 INFO (pid:90347) [language-client-index] - Language server "rust-analyzer" started with 90382
2022-05-13T10:59:18.323 INFO (pid:90347) [services] - Rust Analyzer Language Server state change: starting => running
2022-05-13T10:59:18.333 INFO (pid:90347) [services] - service rust-analyzer started
2022-05-13T10:59:18.345 INFO (pid:90347) [watchman] - watchman watching project: /home/yingmanwumen/Documents/Codes/Leetcode
2022-05-13T10:59:21.073 INFO (pid:90347) [attach] - receive notification: highlight []
2022-05-13T10:59:25.028 INFO (pid:90347) [attach] - receive notification: showInfo []

What's the output of :CocCommand rust-analyzer.serverVersion

[coc.nvim] rust-analyzer 5d5bbec 2022-05-12 dev

I am using nvim v0.6.1, and the coc-rust-analyzer version is 0.56.0

My CocConfig looks like:

{
    "rust-analyzer.server.path": "~/.rustup/toolchains/nightly-x86_64-unkonwn-linux-gnu/bin/rust-analyzer",
    "rust-analyzer.updates.channel": "nightly",
    "rust-analyzer.inlayHints.chainingHints": true,
    "rust-analyzer.inlayHints.typeHints": true,
    "rust-analyzer.inlayHints.refreshOnInsertMode": true
}

I am trying to test inlayHints by this code:

struct SomeStruct;
pub fn main() {
    let some_var = SomeStruct;
}

and the inlay hints doesn't work: Screenshot_20220513_110746

I run this command:

:CocCommand workspace.showOutput

and chose rust-analyzer, then the output is:

[ERROR rust_analyzer::dispatch] unknown request: Request { id: RequestId(I32(3)), method: "rust-analyzer/inlayHints", params: Object({"textDocument": Object({"uri": String("file:///home/yingmanwumen/Documents/Codes/Leetcode/main.rs")})}) }

I don't know what happened and what should I do to fix that.

fannheyward commented 2 years ago

coc-rust-analyzer version is 0.56.0

Upgrade your coc-rust-analyzer, this has been fixed in 0.62.0.