It would be great to have coc extensions setup through configuration rather than manual :CocInstall my-extension commands. I'm un-opinionated as to how this would be accomplished, but I do see a few potential solutions right off the bat:
Plug 'neoclide/coc-extension' would suffice)g:coc_extensions = [ 'json', 'rls', 'prettier', ...]Or however feels best. Ideally, I'd like to be able to clone my vim config, run :PlugInstall, then :CocUpdate and have everything I need without needing to remember or write down which extensions I have installed.
Would be cool to have builtin. I do it already through vim-plug though:
.vimrc#L23-L32 / .vimrc#L134-L150
function! PlugCoc(info) abort
if a:info.status ==? 'installed' || a:info.force
!yarn install
call coc#util#install_extension(join(get(s:, 'coc_extensions', [])))
elseif a:info.status ==? 'updated'
!yarn install
call coc#util#update()
endif
call PlugRemotePlugins(a:info)
endfunction
let s:coc_extensions = [
\ 'coc-css',
\ 'coc-rls',
\ 'coc-html',
\ 'coc-json',
\ 'coc-pyls',
\ 'coc-yaml',
\ 'coc-emmet',
\ 'coc-emoji',
\ 'coc-vetur',
\ 'coc-eslint',
\ 'coc-prettier',
\ 'coc-tsserver',
\ 'coc-ultisnips'
\ ]
Plug 'neoclide/coc-neco'
Plug 'neoclide/coc.nvim', {'do': function('PlugCoc')}
@oblitum's code doesn't quite work. If you swap out !yarn install with cos#util#install() then it really breaks things since CoC.nvim isn't done installing at that point and dies.
It would be really nice to have a global variable or (better yet) a coc-settings.json setting for configuring the desired plugins.
It wouldn't have to do anything special (like uninstall plugins or anything), just do what @oblitum's code does.
The only special check should be if someone uses :CoCUninstall foobar that it check if the install list contains foobar and if it does it should warn the user that next install/upgrade will re-install that extension.
@docwhat, dunno what you mean by it not working since you change it? I use it as-is without issues.
@docwhat use coc#add_extension
W00T! Thanks, @chemzqm.
...
Whups, I found a bug: #353 :cry:
Most helpful comment
Would be cool to have builtin. I do it already through vim-plug though:
.vimrc#L23-L32 / .vimrc#L134-L150