Closed svanharmelen closed 1 year ago
I tried the default setting of explorer.autoExpandOptions
and recursiveSingle
, but the issue still can't be reproduced. Can you provide a minimal reproduce configuration?
I tested and debugged things a bit more and found this code in my init.nvim
to be the problem:
function! s:ShowFilename()
let s:node_info = CocAction('runCommand', 'explorer.getNodeInfo', 0)
redraw | echohl Debug | echom exists('s:node_info.fullpath') ?
\ 'Explorer: ' . s:node_info.fullpath : '' | echohl None
endfunction
autocmd CursorMoved \[coc-explorer\]* :call <SID>ShowFilename()
If I comment out the line let s:node_info = CocAction('runCommand', 'explorer.getNodeInfo', 0)
everything works as expected, so it seems CocAction('runCommand', 'explorer.getNodeInfo', 0)
is causing the freeze.
It may be some problems with CocAction, because CocAction cannot be executed concurrently, you can consider using CocActionAsync(..., s:callbackFunction) ...
function! s:PrintFileName(err, node_info)
redraw | echohl Debug | echom exists('a:node_info.fullpath') ?
\ 'Explorer: ' . a:node_info.fullpath : '' | echohl None
endfunction
function! s:ShowFilename()
call CocActionAsync('runCommand', 'explorer.getNodeInfo', 0, function('s:PrintFileName'))
endfunction
autocmd CursorMoved \[coc-explorer\]* :call <SID>ShowFilename()
That seems to work perfectly! Thanks 👍🏻
Still a bit funny through, that explorer.getNodeInfo
only freezes when there isn't a node (file) to fetch but only directories which it doesn't seem to fetch. Is that expected and not possibly part of the problem?
OK, keep this issue open first, I will look into CocAction in the future.
Closing this as I no longer (for a while now) use coc-explorer
so I'm not able to tell if this is changed or fixed.
Take this folder structure (these are all empty directories without any files):
When I change my directory to
test
, opennvim
andCocExplorer
, navigate to the directorysome
and then pressl
to expand the directory, everything freezes and I need to open another terminal and kill the hanging instance.Another way to trigger the bug is to open
nvim
andCocExplorer
and then in the explorer typeA
to create a new directory and then typesome/thing
as the directory. It will create the directories and then freeze as well.