weirongxu / coc-explorer

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

[Feature Request] Add onCommand event in activationEvents #454

Closed sainnhe closed 3 years ago

sainnhe commented 3 years ago

I want to open coc-explorer together with startify on startup, so I use CocNvimInit event to trigger this action before.

But coc does not wait for extension ready anymore, see https://github.com/neoclide/coc.nvim/issues/3203

The author said a possible solution is adding onCommand event in activationEvents. If it doesn't have any bad effects, could you add it to package.json?

Thanks!

weirongxu commented 3 years ago

I will add it, and consider whether it is possible to start the extension synchronously

weirongxu commented 3 years ago

Added in v0.18.7

sainnhe commented 3 years ago

Thanks, I just tried that and I can confirm coc-explorer can be triggered via CocNvimInit event.

However, I found that by this way, the first time executing CocCommand explorer will be very slow.

Just a discussion, I wonder if it's possible to activate this extension on startup just like the earlier versions, plus add an event like CocExplorerInit so users can open explorer when it's ready.

weirongxu commented 3 years ago

Maybe we should use synchronous instead of onCommand, then coc will load the explorer extension when it start.

weirongxu commented 3 years ago

I modified it on the master branch, could you try it?

weirongxu commented 3 years ago

Just a discussion, I wonder if it's possible to activate this extension on startup just like the earlier versions, plus add an event like CocExplorerInit so users can open explorer when it's ready.

Because coc.nvim has changed its loading policy, it no longer waits for asynchronous extensions, so perhaps using synchronous to start extension is a faster way to go

sainnhe commented 3 years ago

I modified it on the master branch, could you try it?

I just tried master branch, I can confirm that:

  1. It works nicely with CocNvimInit event.
  2. The first time to start explorer is much faster.

Thanks, from my point of view, all problems have been solved :)