fannheyward / coc-rust-analyzer

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

cargo check failed on default rust project #1015

Closed TENX-S closed 2 years ago

TENX-S commented 2 years ago

What's the output of :CocInfo

## versions

vim version: NVIM v0.7.0
node version: v14.2.0
coc.nvim version: 0.0.81-2522eee5 2022-06-14 19:03:29 +0800
coc.nvim directory: /Users/tenx/.vim/plugged/coc.nvim
term: tmux
platform: darwin

## Log of coc.nvim

2022-07-06T20:54:24.613 INFO (pid:93364) [coc-git] - Looking for git in: git
2022-07-06T20:54:24.624 INFO (pid:93364) [plugin] - coc.nvim initialized with node: v14.2.0 after 184ms
2022-07-06T20:54:25.043 INFO (pid:93364) [attach] - receive notification: runCommand [ 'explorer', '--preset', 'floating' ]
2022-07-06T20:54:25.087 INFO (pid:93364) [attach] - receive notification: doAutocmd [ 1 ]
2022-07-06T20:54:25.167 INFO (pid:93364) [attach] - receive notification: doAutocmd [ 1 ]
2022-07-06T20:54:25.298 INFO (pid:93364) [attach] - receive notification: doAutocmd [ 1 ]
2022-07-06T20:54:25.800 INFO (pid:93364) [attach] - receive notification: doAutocmd [ 1 ]
2022-07-06T20:54:26.069 INFO (pid:93364) [attach] - receive notification: doAutocmd [ 1 ]
2022-07-06T20:54:26.316 INFO (pid:93364) [attach] - receive notification: doAutocmd [ 1 ]
2022-07-06T20:54:26.916 INFO (pid:93364) [attach] - receive notification: doAutocmd [ 1 ]
2022-07-06T20:54:27.067 INFO (pid:93364) [attach] - receive notification: doAutocmd [ 1 ]
2022-07-06T20:54:27.284 INFO (pid:93364) [attach] - Request action: doKeymap [ 'explorer-key-n-o' ]
2022-07-06T20:54:27.302 INFO (pid:93364) [attach] - receive notification: doAutocmd [ 1 ]
2022-07-06T20:54:27.308 INFO (pid:93364) [attach] - receive notification: doAutocmd [ 1 ]
2022-07-06T20:54:27.466 INFO (pid:93364) [attach] - receive notification: doAutocmd [ 1 ]
2022-07-06T20:54:27.654 INFO (pid:93364) [attach] - Request action: doKeymap [ 'explorer-key-n-o' ]
2022-07-06T20:54:27.682 INFO (pid:93364) [attach] - receive notification: doAutocmd [ 1 ]
2022-07-06T20:54:27.682 INFO (pid:93364) [attach] - receive notification: runCommand [
  'coc-helper.internal.didVimEvent_m1_v0_13_0_coc_helper_1',
  'BufDelete',
  1
]
2022-07-06T20:54:27.682 INFO (pid:93364) [attach] - receive notification: runCommand [
  'coc-helper.internal.didVimEvent_m1_v0_13_0_explorer_2',
  'BufDelete',
  1
]
2022-07-06T20:54:27.682 INFO (pid:93364) [attach] - receive notification: runCommand [
  'coc-helper.internal.didVimEvent_m1_v0_13_0_coc_helper_1',
  'BufWipeout',
  1
]
2022-07-06T20:54:27.682 INFO (pid:93364) [attach] - receive notification: runCommand [
  'coc-helper.internal.didVimEvent_m1_v0_13_0_explorer_2',
  'BufWipeout',
  1
]
2022-07-06T20:54:27.813 INFO (pid:93364) [services] - registered service "rust-analyzer"
2022-07-06T20:54:27.814 INFO (pid:93364) [services] - Rust Analyzer Language Server state change: stopped => starting
2022-07-06T20:54:27.820 INFO (pid:93364) [attach] - receive notification: doAutocmd [ 1 ]
2022-07-06T20:54:27.832 INFO (pid:93364) [language-client-index] - Language server "rust-analyzer" started with 93476
2022-07-06T20:54:27.846 INFO (pid:93364) [services] - Rust Analyzer Language Server state change: starting => running
2022-07-06T20:54:27.852 INFO (pid:93364) [services] - service rust-analyzer started
2022-07-06T20:54:27.925 INFO (pid:93364) [attach] - receive notification: runCommand [
  'coc-helper.internal.didVimEvent_m1_v0_13_0_explorer_2',
  'CocGitStatusChange'
]
2022-07-06T20:54:28.323 INFO (pid:93364) [attach] - receive notification: doAutocmd [ 1 ]
2022-07-06T20:55:24.614 INFO (pid:93364) [attach] - receive notification: showInfo []

What's the output of :CocCommand rust-analyzer.serverVersion rust-analyzer 0.0.0 (75b22326d 2022-07-03)

macOS 12.4

Screen Shot 2022-07-06 at 20 54 39
fannheyward commented 2 years ago

Can't reproduce.

  1. cd /tmp
  2. cargo new a1 && cd a1
  3. nvim src/main.rs

Set "rust-analyzer.trace.server": "verbose" in your coc-settings.json, reproduce your issue and check :CocCommand workspace.showOutput rust-analyzer

TENX-S commented 2 years ago

output.txt

fannheyward commented 2 years ago
[ERROR flycheck] Flycheck failed to run the following command: "cargo" "fmt" "--workspace" "--message-format=json" "--manifest-path" "/private/tmp/a1/Cargo.toml" "--all-targets"
[ERROR rust_analyzer::lsp_utils] cargo check failed

Cargo watcher failed, the command produced no valid metadata (exit code: ExitStatus(unix_wait_status(256))):
error: Found argument '--workspace' which wasn't expected, or isn't valid in this context

--workspace was unexpected.

TENX-S commented 2 years ago

Whoops. https://github.com/rust-lang/rust-analyzer/issues/6589#issuecomment-1094132030 comment this line works for me, anything wrong about it?

"rust-analyzer.checkOnSave.command": "fmt",
fannheyward commented 2 years ago

I don't think you can use fmt as checkOnSave command.

TENX-S commented 2 years ago

Alright.