错误 CocAction("extensionStats") 不起作用

问题描述

每次我在 Windows 10 中将 neovim 输入到 .js 文件时,我都会收到此错误

Error detected while processing function SwitchFlowOrTsLsps[1]..CocAction:
line    2:
E605: Exception not caught: coc.nvim not ready when invoke CocAction "extensionStats"

在我的配置文件中是发生错误函数

function! SwitchFlowOrTsLsps(flowIndex)
  silent let stats = CocAction("extensionStats")
  silent let tsserver = get(filter(copy(stats),function('FindTsServer')),0)
  if(a:flowIndex == 0)
    if(tsserver.state == 'disabled')
      call CocActionAsync("toggleExtension","coc-tsserver")
    endif
  else
    if(tsserver.state == 'activated')
      call CocActionAsync("toggleExtension","coc-tsserver")
    endif
  endif
endfunction

有人可以帮我吗?虽然告诉我要删除这个函数,但是那个函数还有一些配置我是从github复制过来的,看不懂,不明白是干什么的。

它甚至可能是 Coc 错误,这就是我所看到的,但我不知道如何修复它,我已经安装了 coc-json 和 coc-tsserver,如果我还需要的话,就这么说吧。

谢谢大家。

解决方法

coc.nvim 在调用时没有准备好

在调用此操作之前,您需要确保您的 coc.nvim 已经启动。