Coc.nvim: :write is slow

Created on 7 Apr 2019  路  10Comments  路  Source: neoclide/coc.nvim


CocInfo

vim version: NVIM v0.3.4
node version: v8.9.0
coc.nvim version: 0.0.64
term: xterm-termite
platform: linux

When I save a file (:w) there is a quarter of a second delay until the cursor leaves the command line and is back in the buffer. It's not a lot but it's definitely noticeable. Is there anything that can be done to improve that? There is no noticeable delay when coc.nvim is not used.

To Reproduce

vim set nocompatible set runtimepath^=/path/to/coc.nvim filetype plugin indent on syntax on set hidden

nvim -u mini.vim test
:w

Can't reproduce question

All 10 comments

It can't be async, so no way to fix it.
You can avoid it by remove the filetype from "coc.preferences.formatOnSaveFiletypes" and disable autoFixOnSave provided by extensions.

Were you unable to reproduce the delay?

The above steps open an empty file with no filetype, and the delay is there even with no extensions installed. So the fixes you suggested don't seem to apply.

I can't reproduce, it doesn't do anything on save unless you tell it to.

I think the steps above aren't self-contained because it's still picking up the extensions I have installed even with -u mini.vim. How can I run an instance of nvim without coc loading any of my extensions in order to debug which one is causing the delay?

Try comment this line https://github.com/neoclide/coc.nvim/blob/master/plugin/coc.vim#L177 and see if problem still exists.

Commenting that line removes the delay, yeah.

I've removed document validation on BufWritePre, also add a log for the time cost on save.

on my side, i also had this issue and it works by commenting out BufWritePre

same issue.
Found that better-whitespace plugin slow down.

I was having the same problem, but just inside .cpp files. Commenting the 177th line worked for me.

Was this page helpful?
0 / 5 - 0 ratings