rust-analyzer icon indicating copy to clipboard operation
rust-analyzer copied to clipboard

New rust-analyzer immediately crashes with coc-rust-analyzer

Open dessalines opened this issue 5 years ago • 12 comments

It gives me the error:

The rust analyzer server crashed 5 times in the last 3 minutes. It will not be restarted

## versions

vim version: VIM - Vi IMproved 8.2 8021989
node version: v15.4.0
coc.nvim version: 0.0.79-67cc18bcbf
coc.nvim directory: /home/tyler/.vim_runtime/my_plugins/coc.nvim
term: dumb
platform: linux

## Log of coc.nvim

2020-12-21T09:40:02.780 INFO (pid:444039) [services] - registered service "rust-analyzer"
2020-12-21T09:40:02.783 INFO (pid:444039) [services] - Rust Analyzer Language Server state change: stopped => starting
2020-12-21T09:40:02.797 INFO (pid:444039) [language-client-index] - Language server "rust-analyzer" started with 444051
2020-12-21T09:40:02.825 INFO (pid:444039) [services] - Rust Analyzer Language Server state change: starting => stopped
2020-12-21T09:40:02.825 INFO (pid:444039) [services] - Rust Analyzer Language Server state change: stopped => starting
2020-12-21T09:40:02.831 INFO (pid:444039) [language-client-index] - Language server "rust-analyzer" started with 444055
2020-12-21T09:40:02.835 INFO (pid:444039) [services] - Rust Analyzer Language Server state change: starting => stopped
2020-12-21T09:40:02.835 INFO (pid:444039) [services] - Rust Analyzer Language Server state change: stopped => starting
2020-12-21T09:40:02.838 INFO (pid:444039) [language-client-index] - Language server "rust-analyzer" started with 444058
2020-12-21T09:40:02.841 INFO (pid:444039) [services] - Rust Analyzer Language Server state change: starting => stopped
2020-12-21T09:40:02.841 INFO (pid:444039) [services] - Rust Analyzer Language Server state change: stopped => starting
2020-12-21T09:40:02.844 INFO (pid:444039) [language-client-index] - Language server "rust-analyzer" started with 444061
2020-12-21T09:40:02.847 INFO (pid:444039) [services] - Rust Analyzer Language Server state change: starting => stopped
2020-12-21T09:40:02.847 INFO (pid:444039) [services] - Rust Analyzer Language Server state change: stopped => starting
2020-12-21T09:40:02.850 INFO (pid:444039) [language-client-index] - Language server "rust-analyzer" started with 444064
2020-12-21T09:40:02.853 INFO (pid:444039) [services] - Rust Analyzer Language Server state change: starting => stopped
2020-12-21T09:40:03.755 WARN (pid:444039) [extensions] - Extension coc-rust-analyzer activate cost more than 1s
2020-12-21T09:40:03.765 INFO (pid:444039) [plugin] - coc.nvim 0.0.79-67cc18bcbf initialized with node: v15.4.0 after 1080ms

edit: any easy way to downgrade until this gets fixed?

dessalines avatar Dec 21 '20 14:12 dessalines

Yeah, having the same issue :(

Failed to deserialize InitializeParams: missing field `changeAnnotationSupport`;

https://github.com/fannheyward/coc-rust-analyzer/issues/532

nickbryan avatar Dec 21 '20 14:12 nickbryan

CC https://github.com/gluon-lang/lsp-types/pull/193

flodiebold avatar Dec 21 '20 15:12 flodiebold

Can we see what InitializeParams is in this case?

kjeremy avatar Dec 21 '20 15:12 kjeremy

@dessalines Saw your edit. We have a workaround in fannheyward/coc-rust-analyzer#532

willfindlay avatar Dec 21 '20 21:12 willfindlay

coc-rust-analyzer v0.24.0 has fixed this.

fannheyward avatar Dec 22 '20 01:12 fannheyward

@kjeremy this failure is caused by some capabilities are missing:

  • capabilities.workspace.workspaceEdit.normalizesLineEndings
  • capabilities.workspace.workspaceEdit.changeAnnotationSupport
  • capabilities.textDocument.rename.prepareSupportDefaultBehavior

fannheyward avatar Dec 22 '20 01:12 fannheyward

Why was this closed? All the capabilities listed by @fannheyward are supposedly optional (provided I've read the spec correctly). So RA should either list a minimum supported protocol version or try to fallback gracefully, no?

runiq avatar Dec 22 '20 14:12 runiq

Experienced this in Spacemacs and had to downgrade to 2020-12-14. Not sure if Emacs lsp-mode will support the newer LSP spec yet.

dimitarvp avatar Dec 23 '20 23:12 dimitarvp

Cannot activate rust-analyzer: bootstrap error. See the logs in "OUTPUT > Rust Analyzer Client" (should open automatically). To enable verbose logs use { "rust-analyzer.trace.extension": true }

Hanko2024 avatar Dec 27 '20 11:12 Hanko2024

We've worked around this in nvim-lspconfig using the same mitigation as coc, but I think there should be a tracking issue as I believe this is not in compliance with the LSP spec . See: https://github.com/neovim/nvim-lspconfig/pull/481

mjlbach avatar Jan 01 '21 05:01 mjlbach

This seems to be fixed on latest rust-analyzer (bcb9ae18de1fa405eb2add56409ae264267607bb). It no longer crashes when the new capabilities are not sent in "initialize".

krobelus avatar Jan 10 '21 09:01 krobelus

it's still crash

INFO [2021/2/17 上午10:38:11]: Extension version: 0.2.489
INFO [2021/2/17 上午10:38:11]: Using configuration {
  cargoRunner: null,
  runnableEnv: null,
  inlayHints: {
    enable: true,
    chainingHints: true,
    maxLength: null,
    parameterHints: true,
    typeHints: true
  },
  updates: { channel: 'stable', askBeforeDownload: true },
  server: { path: null, extraEnv: null },
  trace: { server: 'off', extension: false },
  debug: {
    engine: 'auto',
    sourceFileMap: {
      '/rustc/<id>': '${env:USERPROFILE}/.rustup/toolchains/<toolchain-id>/lib/rustlib/src/rust'
    },
    openDebugPane: false,
    engineSettings: {}
  },
  assist: { importMergeBehavior: 'full', importPrefix: 'plain' },
  callInfo: { full: true },
  cargo: {
    autoreload: true,
    allFeatures: false,
    features: [],
    loadOutDirsFromCheck: false,
    noDefaultFeatures: false,
    target: null,
    noSysroot: false
  },
  checkOnSave: {
    enable: true,
    allFeatures: null,
    allTargets: true,
    command: 'check',
    noDefaultFeatures: null,
    target: null,
    extraArgs: [],
    features: null,
    overrideCommand: null
  },
  completion: {
    addCallArgumentSnippets: true,
    addCallParenthesis: true,
    postfix: { enable: true },
    autoimport: { enable: true }
  },
  diagnostics: {
    enable: true,
    enableExperimental: true,
    disabled: [],
    warningsAsHint: [],
    warningsAsInfo: []
  },
  files: { watcher: 'client', excludeDirs: [] },
  hoverActions: {
    debug: true,
    enable: true,
    gotoTypeDef: true,
    implementations: true,
    run: true,
    linksInHover: true
  },
  lens: {
    debug: true,
    enable: true,
    implementations: true,
    run: true,
    methodReferences: false,
    references: false
  },
  linkedProjects: [],
  lruCapacity: null,
  notifications: { cargoTomlNotFound: true },
  procMacro: { enable: false, server: null },
  runnables: { overrideCargo: null, cargoExtraArgs: [] },
  rustcSource: null,
  rustfmt: { extraArgs: [], overrideCommand: null }
}

romanholidaypancakes avatar Feb 17 '21 02:02 romanholidaypancakes