c0r73x / neotags.nvim

Tag highlight in neovim
MIT License
121 stars 9 forks source link

Invalid buffer id #40

Closed henryoliver closed 4 years ago

henryoliver commented 4 years ago

NvimError(b'Invalid buffer id')
Traceback (most recent call last):
  File "/Users/henryoliver/.config/nvim/plugged/neotags.nvim/rplugin/python3/neotags/neotags.py", line 140, in init
    self.update(False)
  File "/Users/henryoliver/.config/nvim/plugged/neotags.nvim/rplugin/python3/neotags/neotags.py", line 181, in update
    self.__groups[ft] = self._parseTags(ft)
  File "/Users/henryoliver/.config/nvim/plugged/neotags.nvim/rplugin/python3/neotags/neotags.py", line 372, in _parseTags
    self.__slurp = '\n'.join(self.__cur['buf'])
  File "/Users/henryoliver/Library/Python/3.7/lib/python/site-packages/pynvim/api/buffer.py", line 75, in __iter__
    lines = self[:]
  File "/Users/henryoliver/Library/Python/3.7/lib/python/site-packages/pynvim/api/buffer.py", line 48, in __getitem__
    return self.request('nvim_buf_get_lines', start, end, False)
  File "/Users/henryoliver/Library/Python/3.7/lib/python/site-packages/pynvim/api/common.py", line 51, in request
    return self._session.request(name, self, *args, **kwargs)
  File "/Users/henryoliver/Library/Python/3.7/lib/python/site-packages/pynvim/api/nvim.py", line 182, in request
    res = self._session.request(name, *args, **kwargs)
  File "/Users/henryoliver/Library/Python/3.7/lib/python/site-packages/pynvim/msgpack_rpc/session.py", line 102, in request
    raise self.error_wrapper(err)
pynvim.api.nvim.NvimError: b'Invalid buffer id'

the call was requested at
  File "/Users/henryoliver/Library/Python/3.7/lib/python/site-packages/pynvim/api/nvim.py", line 222, in filter_notification_cb
    notification_cb(name, args)
  File "/Users/henryoliver/Library/Python/3.7/lib/python/site-packages/pynvim/plugin/host.py", line 120, in _on_notification
    handler(*args)
  File "/Users/henryoliver/Library/Python/3.7/lib/python/site-packages/pynvim/plugin/host.py", line 82, in _wrap_function
    return fn(*args)
  File "/Users/henryoliver/.config/nvim/plugged/neotags.nvim/rplugin/python3/neotags/__init__.py", line 20, in init
    self.__vim.async_call(self.__neotags.init)```
c0r73x commented 4 years ago

Dosn't look like a timeout to me, the error sems to be that i's sending incorrect buffer id for some reason.

henryoliver commented 4 years ago

hi @c0r73x , thanks for replying; the behavior is:

1. Open my vim config file "~/.config/nvim/init.vim" 248L, 7067C

  1. Wait 2min without change anything

  2. Got the error below:

    
    error caught while executing async callback:
    NvimError(b'Invalid buffer id')
    Traceback (most recent call last):
    File "/Users/henryoliver/.config/nvim/plugged/neotags.nvim/rplugin/python3/neotags/neotags.py", line 140, in init
    self.update(False)
    File "/Users/henryoliver/.config/nvim/plugged/neotags.nvim/rplugin/python3/neotags/neotags.py", line 181, in update
    self.__groups[ft] = self._parseTags(ft)
    File "/Users/henryoliver/.config/nvim/plugged/neotags.nvim/rplugin/python3/neotags/neotags.py", line 372, in _parseTags
    self.__slurp = '\n'.join(self.__cur['buf'])
    File "/Users/henryoliver/Library/Python/3.7/lib/python/site-packages/pynvim/api/buffer.py", line 75, in __iter__
    lines = self[:]
    File "/Users/henryoliver/Library/Python/3.7/lib/python/site-packages/pynvim/api/buffer.py", line 48, in __getitem__
    return self.request('nvim_buf_get_lines', start, end, False)
    File "/Users/henryoliver/Library/Python/3.7/lib/python/site-packages/pynvim/api/common.py", line 51, in request
    return self._session.request(name, self, *args, **kwargs)
    File "/Users/henryoliver/Library/Python/3.7/lib/python/site-packages/pynvim/api/nvim.py", line 182, in request
    res = self._session.request(name, *args, **kwargs)
    File "/Users/henryoliver/Library/Python/3.7/lib/python/site-packages/pynvim/msgpack_rpc/session.py", line 102, in request
    raise self.error_wrapper(err)
    pynvim.api.nvim.NvimError: b'Invalid buffer id'

the call was requested at File "/Users/henryoliver/Library/Python/3.7/lib/python/site-packages/pynvim/api/nvim.py", line 222, in filter_notification_cb notification_cb(name, args) File "/Users/henryoliver/Library/Python/3.7/lib/python/site-packages/pynvim/plugin/host.py", line 120, in _on_notification handler(args) File "/Users/henryoliver/Library/Python/3.7/lib/python/site-packages/pynvim/plugin/host.py", line 82, in _wrap_function return fn(args) File "/Users/henryoliver/.config/nvim/plugged/neotags.nvim/rplugin/python3/neotags/init.py", line 20, in init self.__vim.async_call(self.__neotags.init)


Follow my vimrc config for reference:

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

" Themes Plug 'trevordmiller/nova-vim'

" Language Plug 'sheerun/vim-polyglot'

" Completion Plug 'raimondi/delimitmate', { 'for': ['javascript', 'json'] } Plug 'valloric/matchtagalways', { 'for': ['html', 'xml', 'php'] }

" Search Plug 'cloudhead/neovim-fuzzy' Plug 'ripxorip/aerojump.nvim', { 'do': ':UpdateRemotePlugins' }

" Code display Plug 'sbdchd/neoformat' Plug 'csscomb/vim-csscomb', { 'for': ['css', 'stylus', 'scss'] }

" Integrations Plug 'w0rp/ale' Plug 'brooth/far.vim' Plug 'junegunn/gv.vim' Plug 'mhinz/vim-signify' Plug 'tpope/vim-fugitive' Plug 'c0r73x/neotags.nvim'

Plug 'itspriddle/vim-marked', { 'for': 'markdown' }

" Interface Plug 'mbbill/undotree', { 'on': 'UndotreeToggle' } Plug 'junegunn/goyo.vim' Plug 'mhinz/vim-startify'

" Commands Plug 'brooth/far.vim' Plug 'tpope/vim-repeat' Plug 'tpope/vim-surround' Plug 'scrooloose/nerdcommenter' Plug 'AndrewRadev/splitjoin.vim'

" Other Plug 'kassio/neoterm' Plug 'mhinz/vim-sayonara' Plug 'airodactyl/neovim-ranger'

" Initialize plugin system call plug#end()

" Settings " ------------------------------------------------------------------------------ set clipboard+=unnamedplus " Mac OS X clipboard sharing

" Search and Replace set hlsearch " Highlight search results. set ignorecase " Make searching case insensitive set smartcase " ... unless the query has capital letters. set incsearch " Incremental search. set gdefault " Use 'g' flag by default with :s/foo/bar/. set magic " Use 'magic' patterns (extended regular expressions).

" White Space set tabstop=4 " Set tab to equal 4 spaces. set expandtab " Expand tabs into spaces. set shiftwidth=4 " Set auto indent spacing. set softtabstop=4 " Set soft tabs equal to 4 spaces. set smartindent " Does the right thing (mostly) in programs set shiftround " Shift to the next round tab stop. set textwidth=0 " Hard-wrap long lines as you type them. set conceallevel=0 " Text is shown normally

set listchars=tab:··,trail:· " Show leading whitespace set list " Displays whitespace

" Presentation set shortmess=aIoO " Show short messages, no intro. set showcmd " Show (partial) command in status line. set ruler " Show the cursor position. set cf " Enable error jumping. set hidden " Allow hidden buffers.

set number " Show line numbers set relativenumber " Relative line numbers set nocursorline " Highlight the line containing the cursor.

set cc=80 " Highlight column at 80 set linespace=0 " Set line-spacing to minimum. set nowrap " Disable line wrapping.

set nojoinspaces " Prevents inserting two spaces after punctuation on a join (J) set showmatch " Show matching parenthesis. set matchpairs+=<:> " Pairs to match.

set splitbelow " Horizontal split below current. set splitright " Vertical split to right of current.

set scrolloff=3 " Show next 3 lines while scrolling. set sidescrolloff=5 " Show next 5 columns while side-scrolling. set display+=lastline set nostartofline " Do not jump to first character with page commands.

set foldmethod=indent " Fold based on indent set foldnestmax=20 " Deepest fold is 20 levels set nofoldenable " Don't fold by default set foldlevel=1

syntax enable " Enable syntax highlighting. filetype plugin indent on " Load syntax files for better indenting.

" User Interface set termguicolors colorscheme nova

" Status Line set laststatus=2 " Always show status. set fillchars+=stl:\ ,stlnc:\ " Space. " Disable status line fill chars. set noshowmode " Get rid of the default mode indicator set cmdheight=1

" Plugins

" Netrw let loaded_netrwPlugin = 1

" ALE let g:ale_lint_on_enter = 0 let g:ale_lint_on_text_changed = 'never'

" Vim-signify let g:signify_vcs_list = ['git']

" Undotree let g:undotree_WindowLayout = 2

" Mappings " ------------------------------------------------------------------------------

" Leader let mapleader = ' '

" Use Q to execute default register. nnoremap Q @q

" Remap esc imap jj

" Use v to toggle visual mode. vno v

" Remap arrows up and down cnoremap cnoremap

" Copy current files path to clipboard nmap cp :let @+ = expand('%')

" Quickly edit/reload the vimrc file nmap ev :e $MYVIMRC nmap sv :so $MYVIMRC

" Switch Off The Current Search nnoremap / :nohlsearch

" Mappings to quickly traverse buffer lists nnoremap [b :bprevious nnoremap ]b :bnext nnoremap [B :bfirst nnoremap ]B :blast

" Clean the highlight text map h :set hlsearch!

" Save nnoremap s :update nnoremap w :update

" Quit nnoremap q :q nnoremap Q :qa!

" Open file on Chrome Canary nnoremap :!open -a Google\ Chrome\ Canary %

" Plugins

" ALE nmap (ale_previous_wrap) nmap (ale_next_wrap)

" Neoformat noremap ff :Neoformat

" Undotree nnoremap U :UndotreeToggle

" Goyo nnoremap G :Goyo

" Fuzzy nnoremap :FuzzyOpen nnoremap :FuzzyGrep

"Git commits for the current buffer nnoremap ga :BCommits

"Git commits (requires fugitive.vim) nnoremap gl :Commits nnoremap ft :Filetypes nnoremap ht :Helptags

" Sayonara cnoreabbrev x getcmdtype() == ":" && getcmdline() == 'x' ? 'Sayonara' : 'x'

" Functions " ------------------------------------------------------------------------------

" Copy file command! -nargs=1 -complete=file Cp :w | :e

" Plugins

" FZY function! FzyCommand(choice_command, vim_command) try let output = system(a:choice_command . " | fzy ") catch /Vim:Interrupt/ " Swallow errors from ^C, allow redraw! below endtry redraw! if v:shell_error == 0 && !empty(output) exec a:vim_command . ' ' . output endif endfunction

" Gv.vim function! s:gv_expand() let line = getline('.') GV --name-status call search('\V'.line, 'c') normal! zz endfunction autocmd! FileType GV nnoremap + :call gv_expand()

c0r73x commented 4 years ago

Very strange error. I will add some exception handling to the part of the code that fails this weekend and try to atleast get some sane error/reason why it crashes.

henryoliver commented 4 years ago

thanks, @c0r73x, appreciate that.

henryoliver commented 4 years ago

hey @c0r73x , did you get a chance to review this issue? I'm getting it every time that I open the vimrc file or the terminal emulator.

Thanks! Henry

c0r73x commented 4 years ago

@henryoliver sorry i've been busy with stuff irl, i will try to get some time soon to debug it.

henryoliver commented 4 years ago

Hey @c0r73x , really appreciate your effort here, thanks!

To be honest I could not figure out how to use this plugin yet, im getting all kind of errors as follow:

Ctags process timed out!

no notification handler registered for ".../.config/nvim/plugged/neotags.nvim/rplugin/python3/neotags:function:NeotagsInit"

I get the correct folder generated, everything seems to look fine, but all of sudden some error appears.

Maybe its something that im doing wrong, can you tell me how can I jump through tags using your plugin, maybe we can start from there, what do you think?

Again, thank you!

c0r73x commented 4 years ago

Humm, what version of ctags are you using?

You jump through them using vims commands, neotags fills vims default tags. https://vim.fandom.com/wiki/Browsing_programs_with_tags

I hope this helps ;)

henryoliver commented 4 years ago

@c0r73x im using:

❯ ctags --version
Universal Ctags 0.0.0(42b74d5), Copyright (C) 2015 Universal Ctags Team
Universal Ctags is derived from Exuberant Ctags.
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
  Compiled: Oct 20 2019, 20:55:42
  URL: https://ctags.io/
  Optional compiled features: +wildcards, +regex, +iconv, +option-directory, +xpath, +case-insensitive-filenames, +packcc

Every time I try to jump it I get the same message:

E433: No tags file
E426: tag not found: showLightbox
Press ENTER or type command to continue
henryoliver commented 4 years ago

Hey @c0r73x , sorry to bother you, but do you have any update on this issue?

I really can't figure out what's wrong with the plugin, so the tag file gets generated inside .vim-tags folder but the plugin never finds it.

Please, let me know if I'm missing anything.

Thanks -- Henry

c0r73x commented 4 years ago

Humm, that's odd. if you run :set tags do the file show up there?

henryoliver commented 4 years ago

@c0r73x the output is: tags=./tags;,tags

Should it point to .vim_tags instead? I'm nothing getting what I'm doing wrong.

Thank you for you help again @c0r73x .

c0r73x commented 4 years ago

Yeah that look incorrect. When neotags has generated new tags for your project it should update the tags variable with a new tagfile. You could try to add it and see if it works, with set tags+=~/.vim_tags/tags

I would recomend running NeotagsVerbosity before you save your file to see if there are any errors.

henryoliver commented 4 years ago

@c0r73x Im suspecting that neovim is not capable to access the bin ctags to generate the tags on the .vim_tags folder:

Screen Shot 2019-11-06 at 1 52 29 PM
❯ ctags --version
Universal Ctags 0.0.0(42b74d5), Copyright (C) 2015 Universal Ctags Team
Universal Ctags is derived from Exuberant Ctags.
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
  Compiled: Oct 20 2019, 20:55:42
  URL: https://ctags.io/
  Optional compiled features: +wildcards, +regex, +iconv, +option-directory, +xpath, +case-insensitive-filenames, +packcc

❯ which ctags
/usr/local/bin/ctags

If I run ctags -R on the terminal it works well.

c0r73x commented 4 years ago

Could you try to set g:neotags_ctags_bin = '/usr/local/bin/ctags'

henryoliver commented 4 years ago
/usr/local/bin/ctags --fields=+l --c-kinds=+p --c++-kinds=+p --sort=yes --exclude='.mypy_cache' --regex-go='/^\s*(var)?\s*(\w*)\s*:?=\s*func/\2/f/' --exclude='*Makefile' --exclude='*Makefile.in' --exclude='*aclocal.m4' --exclude='*config.guess' --exclude='*config.h.in' --exclude='*config.log' --excl
ude='*config.status' --exclude='*configure' --exclude='*depcomp' --exclude='*install-sh' --exclude='*missing' -f "/Users/henryoliver/.vim_tags/__Users__henryoliver__Projects__PhotoDay__Development__photoday-web-studio.tags" -R "/Users/henryoliver/Projects/PhotoDay/Development/photoday-web-studio"
Press ENTER or type command to continue

E433: No tags file E426: tag not found: getPhoto

Looks like the .tag file was created, but I i'm still getting the error below:

error caught while executing async callback:
NvimError(b'Invalid buffer id')
Traceback (most recent call last):
  File "/Users/henryoliver/.config/nvim/plugged/neotags.nvim/rplugin/python3/neotags/neotags.py", line 181, in update
    self.__groups[ft] = self._parseTags(ft)
  File "/Users/henryoliver/.config/nvim/plugged/neotags.nvim/rplugin/python3/neotags/neotags.py", line 375, in _parseTags
    self.__slurp = '\n'.join(self.__cur['buf'])
  File "/Users/henryoliver/Library/Python/3.7/lib/python/site-packages/pynvim/api/buffer.py", line 75, in __iter__
    lines = self[:]
  File "/Users/henryoliver/Library/Python/3.7/lib/python/site-packages/pynvim/api/buffer.py", line 48, in __getitem__
    return self.request('nvim_buf_get_lines', start, end, False)
  File "/Users/henryoliver/Library/Python/3.7/lib/python/site-packages/pynvim/api/common.py", line 51, in request
    return self._session.request(name, self, *args, **kwargs)
  File "/Users/henryoliver/Library/Python/3.7/lib/python/site-packages/pynvim/api/nvim.py", line 182, in request
    res = self._session.request(name, *args, **kwargs)
  File "/Users/henryoliver/Library/Python/3.7/lib/python/site-packages/pynvim/msgpack_rpc/session.py", line 102, in request
    raise self.error_wrapper(err)
pynvim.api.nvim.NvimError: b'Invalid buffer id'

the call was requested at
  File "/Users/henryoliver/Library/Python/3.7/lib/python/site-packages/pynvim/api/nvim.py", line 222, in filter_notification_cb
    notification_cb(name, args)
  File "/Users/henryoliver/Library/Python/3.7/lib/python/site-packages/pynvim/plugin/host.py", line 120, in _on_notification
    handler(*args)
  File "/Users/henryoliver/Library/Python/3.7/lib/python/site-packages/pynvim/plugin/host.py", line 82, in _wrap_function
    return fn(*args)
  File "/Users/henryoliver/.config/nvim/plugged/neotags.nvim/rplugin/python3/neotags/__init__.py", line 24, in highlight
    self.__vim.async_call(self.__neotags.update, False)
Neotags: Error: directory '/Users/henryoliver/Projects/PhotoDay/Development/photoday-web-studio' is already saved as a project base.
error caught while executing async callback:
NvimError(b'Invalid buffer id')
Traceback (most recent call last):
  File "/Users/henryoliver/.config/nvim/plugged/neotags.nvim/rplugin/python3/neotags/neotags.py", line 181, in update
    self.__groups[ft] = self._parseTags(ft)
  File "/Users/henryoliver/.config/nvim/plugged/neotags.nvim/rplugin/python3/neotags/neotags.py", line 375, in _parseTags
    self.__slurp = '\n'.join(self.__cur['buf'])
  File "/Users/henryoliver/Library/Python/3.7/lib/python/site-packages/pynvim/api/buffer.py", line 75, in __iter__
    lines = self[:]
  File "/Users/henryoliver/Library/Python/3.7/lib/python/site-packages/pynvim/api/buffer.py", line 48, in __getitem__
    return self.request('nvim_buf_get_lines', start, end, False)
  File "/Users/henryoliver/Library/Python/3.7/lib/python/site-packages/pynvim/api/common.py", line 51, in request
    return self._session.request(name, self, *args, **kwargs)
  File "/Users/henryoliver/Library/Python/3.7/lib/python/site-packages/pynvim/api/nvim.py", line 182, in request
    res = self._session.request(name, *args, **kwargs)
  File "/Users/henryoliver/Library/Python/3.7/lib/python/site-packages/pynvim/msgpack_rpc/session.py", line 102, in request
    raise self.error_wrapper(err)
pynvim.api.nvim.NvimError: b'Invalid buffer id'

the call was requested at
  File "/Users/henryoliver/Library/Python/3.7/lib/python/site-packages/pynvim/api/nvim.py", line 222, in filter_notification_cb
    notification_cb(name, args)
  File "/Users/henryoliver/Library/Python/3.7/lib/python/site-packages/pynvim/plugin/host.py", line 120, in _on_notification
    handler(*args)
  File "/Users/henryoliver/Library/Python/3.7/lib/python/site-packages/pynvim/plugin/host.py", line 82, in _wrap_function
    return fn(*args)
  File "/Users/henryoliver/.config/nvim/plugged/neotags.nvim/rplugin/python3/neotags/__init__.py", line 24, in highlight
    self.__vim.async_call(self.__neotags.update, False)
Neotags: Ctags completed with errors
Neotags: ctags: Warning: cannot open input file "/Users/henryoliver/Projects/....-web-customer/term:/1488:fzy -l 12 > /var/folders/wx/7652cs1j70l1801c2s3mf9hh0000gn/T/nvimHflkDO/72 < /var/folders/wx/7652cs1j70l1801c2s3mf9hh0000gn/T/nvimHflkDO" : No such file or directory
Press ENTER or type command to continue
c0r73x commented 4 years ago

Humm i've seen similar issues when using the binary version of neotags 🤔 Other than that i'm out of ideas :(

henryoliver commented 4 years ago

thats fine @c0r73x i'll just move on. Thanks for your help!