Coc.nvim: Can't install binary with minpac

Created on 30 Nov 2018  路  10Comments  路  Source: neoclide/coc.nvim

Result from CocInfo
Not an editor command: CocInfo

Describe the bug
None of the features work, all of the commands are missing except CocInstall, CocRebuild, CocRestart, CocUninstall, CocUpdate

To Reproduce
This .vimrc with minpac script in pack folder. Type :Coc and press tab

Thanks in advance :)

All 10 comments

Should be problem of {'do': { -> coc#util#install() }} with minpac.
You can install the binary by :call coc#util#install() in your vim.

Thanks for the quick reply, you're right, minpac didn't call install after installing but I removed and readded coc with the 'do' and it works now

Thanks!

This {'do': { -> coc#util#install() }} doesn't seem to be working with minpac anymore, any idea why?

perhaps it doesn't support use function like that.

I tried most of the variations here https://github.com/k-takata/minpac#hooks

It's vim's problem, the function can't be found when the plugin is in package folder.
Use {'do': './install.sh'}) instead.

I ended up doing this.

  let s:coc_extensions = [
        \ 'coc-css',
        \ 'coc-rls',
        \ 'coc-html',
        \ 'coc-json',
        \ 'coc-pyls',
        \ 'coc-yaml',
        \ 'coc-emoji',
        \ 'coc-tsserver',
        \ 'coc-ultisnips',
        \ 'coc-highlight',
        \ 'coc-yaml'
        \ ]

  function! s:coc_plugins(hooktype, name) abort
    execute 'packadd ' . a:name " <-- this is the key
    call coc#util#install()
    call coc#util#install_extension(join(get(s:, 'coc_extensions', [])))
  endfunction

  call minpac#add('https://github.com/neoclide/coc.nvim', {'do': function('s:coc_plugins')})

You can just use g:coc_global_extensions to replace s:coc_extensions and call coc#util#install_extension

I ended up doing this.

  let s:coc_extensions = [
        \ 'coc-css',
        \ 'coc-rls',
        \ 'coc-html',
        \ 'coc-json',
        \ 'coc-pyls',
        \ 'coc-yaml',
        \ 'coc-emoji',
        \ 'coc-tsserver',
        \ 'coc-ultisnips',
        \ 'coc-highlight',
        \ 'coc-yaml'
        \ ]

  function! s:coc_plugins(hooktype, name) abort
    execute 'packadd ' . a:name " <-- this is the key
    call coc#util#install()
    call coc#util#install_extension(join(get(s:, 'coc_extensions', [])))
  endfunction

  call minpac#add('https://github.com/neoclide/coc.nvim', {'do': function('s:coc_plugins')})

@ahmedelgabri

Not sure what you ended up going with, but I spent a little time this afternoon trying to update Coc and it's extensions, and this is what I came up with. In short, I believe it should update Coc plugin ie. rebuild it if required and also update the extensions that are stored in the global var. It far from a perfect example, but it is better than what I was doing, where I was manually calling functions after updating packages ie. Coc and running PackClean PackUpdate from (n)Vim command mode.

function! CocBuildUpdate()
  if has('nvim')
    " NOTE: setup a `list` in VimL to supply the Coc `install_extension` func
    " TODO: autogen global_extensions in a var, ie. don't hardcode
    let g:coc_global_extensions = [
          \ 'coc-css',
          \ 'coc-html',
          \ 'coc-json',
          \ ]
    call coc#util#install()
    call coc#util#install_extension(g:coc_global_extensions)
  endif
endfunction

I am far from being a VimL ninja but this appears to be working for me with the latest version of Neovim and I check for Neovim because I use the same .vimrc for both Neovim and Vim 8.x

I have a command that I run periodically to check / update (n)Vim packages

command! PackUpdate packadd minpac | source $MYVIMRC | call minpac#update('', {'do': 'call minpac#status()'})

_Leaving this here for FUTURE ME_

@ipatch this is what I ended up doing, the same as I posted above. Still a bit flaky

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tom-james-watson picture tom-james-watson  路  3Comments

iago-lito picture iago-lito  路  3Comments

aareman picture aareman  路  3Comments

marene picture marene  路  3Comments

cvlmtg picture cvlmtg  路  3Comments