neoclide / coc.nvim

Nodejs extension host for vim & neovim, load extensions like VSCode and host language servers.
Other
24.33k stars 956 forks source link

willSaveTimeout happens often with elm-format #895

Closed andys8 closed 5 years ago

andys8 commented 5 years ago

Is your feature request related to a problem? Please describe. With "coc.preferences.formatOnSaveFiletypes": ["elm"] using elm-format I get most of the time the timeout error.

[coc.nvim] languageserver will save operation timeout after 0.5s

https://github.com/neoclide/coc.nvim/blob/9944b53f45fe0ad1f0ce0f04423c04ad826a679b/src/model/willSaveHandler.ts#L30

Describe the solution you'd like

Describe alternatives you've considered Using an ale fixer to do formatting.

Additional context

time elm-format src/Main.elm --yes                                                                                                                    
Processing file src/Main.elm
0.47user 0.03system 0:00.43elapsed 116%CPU (0avgtext+0avgdata 53168maxresident)k
0inputs+48outputs (0major+9855minor)pagefaults 0swaps

Running elm-format in the terminal on the file takes 430ms. So chances are high that 500 ms will not be enough.

This is the language server used in the example. https://github.com/elm-tooling/elm-language-server#cocnvim

chemzqm commented 5 years ago

It's by design, the format should not take more than 0.5s. You can use

    autocmd BufWritePre   *.elm call CocAction('format')

instead.

nomasprime commented 3 years ago

Configuring per type would be preferable.