neoclide / coc.nvim

Nodejs extension host for vim & neovim, load extensions like VSCode and host language servers.
Other
24.31k stars 956 forks source link

fatal: invalid reference: release #3586

Closed kanglcn closed 2 years ago

kanglcn commented 2 years ago

Result from CocInfo

Error: javascript bundle not found, please compile code of coc.nvim by esbuild.

Describe the bug

I am using the release branch, I got this when I run :PlugStatus

Invalid branch: master (expected: release). Try PlugUpdate.

But running PlugUpdate do not work.

neovim version : NVIM v0.6.0 nodejs version: v14.17.4 installed by conda

centos 7

Reproduce the bug

We will close your issue when you don't provide minimal vimrc and we can't reproduce it


" === Auto load Vim Plug for first time uses
if empty(glob('~/.config/nvim/autoload/plug.vim'))
  silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs
        \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif

" ==

call plug#begin('~/.config/nvim/plugged')

" Auto Complete
Plug 'neoclide/coc.nvim', {'branch': 'release'}
" main one
"Plug 'neovim/nvim-lspconfig'
"Plug 'ms-jpq/coq_nvim', {'branch': 'coq'}
"" 9000+ Snippets
"Plug 'ms-jpq/coq.artifacts', {'branch': 'artifacts'}
"
"" lua & third party sources -- See https://github.com/ms-jpq/coq.thirdparty
"" Need to **configure separately**
"
"Plug 'ms-jpq/coq.thirdparty', {'branch': '3p'}
" - shell repl
" - nvim lua api
" - scientific calculator
" - comment banner
" - etc

call plug#end()

" coc.nvim
let g:coc_global_extensions = [
      \ 'coc-clangd',
      \ 'coc-cmake',
      \ 'coc-diagnostic',
      \ 'coc-json',
      \ 'coc-lists',
      \ 'coc-pyright',
      \ 'coc-snippets',
      \ 'coc-vimtex',
      \ 'coc-sh',
      \ 'coc-todolist',
      \ 'coc-vimlsp']

" Use tab for trigger completion with characters ahead and navigate.
inoremap <silent><expr> <TAB>
      \ pumvisible() ? "\<C-n>" :
      \ <SID>check_back_space() ? "\<TAB>" :
      \ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"

function! s:check_back_space() abort
  let col = col('.') - 1
  return !col || getline('.')[col - 1]  =~# '\s'
endfunction

inoremap <silent><expr> <c-c> coc#refresh()

" Show coc commands.
nnoremap coc :CocCommand<CR>

" Make <CR> auto-select the first completion item and notify coc.nvim to
" format on enter, <cr> could be remapped by other vim plugin
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
      \: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"

" Use `[g` and `]g` to navigate diagnostics
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list.
nnoremap <silent><nowait> <LEADER>d :CocList diagnostics<cr>
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)

" GoTo code navigation.
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)

" Coc snippets
" Use <C-j> for select text for visual placeholder of snippet.
vmap <C-j> <Plug>(coc-snippets-select)

" Use <C-j> for jump to next placeholder, it's default of coc.nvim
let g:coc_snippet_next = '<c-j>'

" Use <C-k> for jump to previous placeholder, it's default of coc.nvim
let g:coc_snippet_prev = '<c-k>'

" Use <C-j> for both expand and jump (make expand higher priority.)
imap <C-j> <Plug>(coc-snippets-expand-jump)

" Use <leader>x for convert visual selected code to snippet
xmap <leader>x  <Plug>(coc-convert-snippet)

" Use gh to show documentation in preview window.
nnoremap <silent> gh :call <SID>show_documentation()<CR>

function! s:show_documentation()
  if (index(['vim','help'], &filetype) >= 0)
    execute 'h '.expand('<cword>')
  elseif (coc#rpc#ready())
    call CocActionAsync('doHover')
  else
    execute '!' . &keywordprg . " " . expand('<cword>')
  endif
endfunction
chemzqm commented 2 years ago

Remove coc.nvim folder and reinstall it

kanglcn commented 2 years ago

Remove coc.nvim folder and reinstall it

It doesn't work.

chemzqm commented 2 years ago

Read wiki

mdeguzis commented 2 years ago

I get the same issue. I see @chemzqm chimed in on the other issues. Can you try to point to something specific instead of commenting like this? It is not helpful. Your own README.md notes this method for Vim-Plug an it does not work. Neither do any other suggestions of cleaning out directories or updating Vim-Plug.

For all others who face this issue, you can use the following workaround:

Plug 'neoclide/coc.nvim', {'commit': 'b9c208ef6d81102987c57e2451858db8d77b78eb'}

Obviously this will not auto-update with PlugUpdate.

I do think this is a problem with Vim Plug somehow, not CoC.vim. As when I uncommented another plugin I used to use, I got the same error:

  5 x YCM-Generator:                                                                                                                                                                  
  6     fatal: invalid reference: stable 

Sample vim-plug issue: https://github.com/junegunn/vim-plug/issues/1004

chemzqm commented 2 years ago

Upgrade vim-plug and cleanup the folder of coc.nvim

doctorbigtime commented 2 years ago

I was able to resolve this by upgrading my git version. Centos 7 being so old, the default git version (1.8) doesn't support cloning by branch. Check https://serverfault.com/questions/709433/install-a-newer-version-of-git-on-centos-7 for info on how to update the git version.