weirongxu / coc-explorer

📁 Explorer for coc.nvim
MIT License
1.14k stars 45 forks source link

LSP诊断导致icon丢失 #485

Closed lth-go closed 2 years ago

lth-go commented 2 years ago

图片

发现lsp诊断事件上报给 src/source/sources/file/child-columns/icon.ts:8 的nodes仅仅只有几个, 导致下面drawNode找不到图标,使得无法显示图标

weirongxu commented 2 years ago

更新到 coc-explorer 最新版本了吗? 我这边没有重现这个问题。 方便的话,请提供一下相关的配置

lth-go commented 2 years ago

更新到 coc-explorer 最新版本了吗? 我这边没有重现这个问题。 方便的话,请提供一下相关的配置

应该与配置无关,我刚试了最小配置的情况

{
  "suggest.enablePreselect": false,
  "coc.preferences.currentFunctionSymbolAutoUpdate": true,
  "explorer.icon.enableNerdfont": true,
  "explorer.icon.source": "nvim-web-devicons",
  "explorer.openAction.strategy": "sourceWindow",
  "explorer.sources":[
    {
      "name": "file",
      "expand": true
    }
  ],
  "explorer.file.root.template": "[icon] [root]"
}

复现步骤:

  1. 随便写个错误, 例如上图,var foo;
  2. 关闭然后打开导航, 重复几次, 会大概率出现图标丢失问题

我排查了下,发现原因是,打开导航会触发图标重画, 但同时打开导航也会出发lsp的诊断的图标重画, 这时候两个执行顺序是随机的,其中一种顺序会导致丢图标