question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rust-analyzer times out when a large buffer is open.

See original GitHub issue

What’s the output of :CocInfo


vim version: VIM - Vi IMproved 8.1 8012269
node version: v12.22.7
coc.nvim version: 0.0.80-cf98cf301f
coc.nvim directory: /home/jakew/.vim/bundle/coc.nvim
term: dumb
platform: linux

## Log of coc.nvim

2021-11-18T09:30:01.389 INFO (pid:1544) [plugin] - coc.nvim 0.0.80-cf98cf301f initialized with node: v12.22.7 after 43ms
2021-11-18T09:30:03.860 INFO (pid:1544) [services] - registered service "rust-analyzer"
2021-11-18T09:30:03.860 INFO (pid:1544) [services] - Rust Analyzer Language Server state change: stopped => starting
2021-11-18T09:30:03.889 INFO (pid:1544) [language-client-index] - Language server "rust-analyzer" started with 1567
2021-11-18T09:30:03.896 INFO (pid:1544) [services] - Rust Analyzer Language Server state change: starting => running
2021-11-18T09:30:03.902 INFO (pid:1544) [services] - service rust-analyzer started
2021-11-18T09:30:17.879 INFO (pid:1544) [completion-complete] - Results from: around,rust-analyzer
2021-11-18T09:33:02.607 INFO (pid:1544) [completion-complete] - Results from: around,buffer
2021-11-18T09:33:54.483 INFO (pid:1544) [attach] - receive notification: runCommand [ 'rust-analyzer.serverVersion' ]
2021-11-18T09:35:00.418 INFO (pid:1544) [attach] - receive notification: showInfo []
2021-11-18T09:37:07.566 INFO (pid:1544) [completion-complete] - Results from: around,buffer
2021-11-18T09:37:59.867 INFO (pid:1544) [attach] - receive notification: showInfo []

What’s the output of :CocCommand rust-analyzer.serverVersion [coc.nvim] rust-analyzer 73668334f 2021-11-15 stable

My tests have some large files that they open (about 80k line csv). When I:

  1. Open lib.rs in my rust project into a buffer.
  2. Open tests/input/large.csv into another buffer.
  3. Make a change to lib.rs.
  4. Save the change.

Vim will hang for a while and then give the message: “rust-analyzer timeout after 5000ms”.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jacwellingtoncommented, Nov 22, 2021

I figured out that if I tell coc-list to ignore buffers this problem goes away. I did that by using the :CocConfig command and putting this in my settings file:

{
        "coc.source.buffer.enable": false
}
0reactions
jacwellingtoncommented, Nov 22, 2021

I figured out the source of the problem. I believe it is the set hidden setting that is triggering this for some reason. Here is a minimal vimrc that I used in order to recreate the behavior:

set nocompatible
set hidden
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'

" My Bundles here:
"
" original repos on github
Bundle 'neoclide/coc.nvim', 'release'
Bundle 'rust-lang/rust.vim'

call vundle#end()
filetype plugin indent on     " required!

syntax on

If I remove set hidden then everything works fine. Any idea why this might be?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Allow to buffer more input messages · Issue #2879 · rust-lang ...
I just observe rust-analyzer running with like 100%+ cpu usage and my Emacs freezes. Ctrl + g works for a moment and it...
Read more >
User Manual - rust-analyzer
At its core, rust-analyzer is a library for semantic analysis of Rust code as it changes over time. This manual focuses on a...
Read more >
Neovim rust analyzer issue. : r/rust - Reddit
nvim is trying to use it. :LspInfo. And see if you have the rust_analyzer attached. Detected filetype: rust 1 client(s) attached to this...
Read more >
Rust-analyzer doesn't check the buffer on typing, but only on ...
No, it's because your system would likely grind to a halt if you did this and also opened a large rust project. Analyzing...
Read more >
Proc macro support in rust-analyzer for nightly rustc versions
And that's not a good answer? Not really, no. At that point, the asker is usually nervously looking at the time, and they...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found