neoclide / coc-highlight

Document highlight and document colors LSP support for coc.nvim
221 stars 12 forks source link

Freeze when `:call CocAction('colorPresentation')` is executed. #37

Closed aasril closed 3 years ago

aasril commented 3 years ago

I put the cursor over a color code (rgb) and then ran the command. The popup will show up eventually, but not after freezing for a minute or so. Coc.nvim is up-to-date.

From profile.log:

FUNCTIONS SORTED ON TOTAL TIME
count  | total (s) |  self (s) | function
    2  | 60.065162  |  0.000086  | coc#rpc#request()
    2  | 60.065025  | 60.063749 |  <SNR>30_request()
    1  | 60.064558  | 0.000034  | CocAction()

========================================
FUNCTION  coc#rpc#request()
    Defined: ~/.vim/plugged/coc.nvim/autoload/coc/rpc.vim:88
Called 2 times
Total time:  60.065162
 Self time:   0.000086

count  total (s)   self (s)
    2   0.000075   0.000024   if !coc#rpc#ready()
                                return ''
    2              0.000003   endif
    2  60.065076   0.000051   return s:client['request'](a:method, a:args)
=========================================
FUNCTION  <SNR>30_request()
    Defined: ~/.vim/plugged/coc.nvim/autoload/coc/client.vim:134
Called 2 times
Total time:  60.065025
 Self time:  60.063749

count  total (s)   self (s)
    2   0.000056   0.000036   let channel = coc#client#get_channel(self)
    2              0.000020   if empty(channel) | return '' | endif
    2              0.000004   try
    2              0.000005     if s:is_vim
    2  60.064308  60.063052       let res = ch_evalexpr(channel, [a:method, a:args], {'timeout': 60 * 1000})
    2              0.000038       if type(res) == 1 && res ==# ''
    1              0.000043         throw 'request '.a:method. ' '.string(a:args).' timeout after 60s'
    1              0.000002       endif
    1              0.000004       let [l:errmsg, res] =  res
    1              0.000003       if !empty(l:errmsg)
                                    throw l:errmsg
    1              0.000001       else
    1              0.000003         return res
                                  endif
                                else
                                  return call('rpcrequest', [channel, a:method] + a:args)
                                endif
    1              0.000088   catch /.*/
    1              0.000021     if v:exception =~# 'E475'
                                  if get(g:, 'coc_vim_leaving', 0) | return | endif
                                  echohl Error | echom '['.self.name.'] server connection lost' | echohl None
                                  let name = self.name
                                  call s:on_exit(name, 0)
                                  execute 'silent do User ConnectionLost'.toupper(name[0]).name[1:]
    1              0.000019     elseif v:exception =~# 'E12'
                                  " neovim's bug, ignore it
    1              0.000003     else
    1              0.000227       echohl Error | echo 'Error on request ('.a:method.'): '.v:exception | echohl None
    1              0.000004     endif
    2              0.000008   endtry

==========================================

FUNCTION  CocAction()
    Defined: ~/.vim/plugged/coc.nvim/plugin/coc.vim:69
Called 1 time
Total time:  60.064558
 Self time:   0.000034

count  total (s)   self (s)
    1  60.064555   0.000031   return coc#rpc#request(a:name, a:000)
chemzqm commented 3 years ago

You have to use CocActionAsync instead