codota / tabnine-vim

Vim client for TabNine. https://vimawesome.com/plugin/tabnine-vim
https://www.tabnine.com/install/vim
GNU General Public License v3.0
672 stars 36 forks source link

TabNine hangs with ctags when YCM semantic triggers #7

Closed yous closed 3 years ago

yous commented 6 years ago

I think TabNine processes tags file also, and this cause some bugs. Because it's in global gitignore, TabNine doesn't know it should be excluded.

This would reproduce the problem:

git clone --depth 1 https://github.com/gcc-mirror/gcc.git
cd gcc
ctags -R

I'm using Homebrew Vim 8.1.500. The minimal test.vimrc:

set nocompatible
call plug#begin()
Plug 'zxqfl/tabnine-vim'
call plug#end()

I used Exuberant Ctags 5.8.

$ ctags --version
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
  Compiled: Mar 16 2015, 23:48:18
  Addresses: <dhiebert@users.sourceforge.net>, http://ctags.sourceforge.net
  Optional compiled features: +wildcards, +regex

Run vim -u test.vimrc gcc/cfgrtl.c and go to line 279. Press o to append after that line, then type bb_note->. Then Vim hangs. When I press Ctrl-C, the following messages are displayed:

Error detected while processing function <SNR>26_OnTextChangedInsertMode[26]..<SNR>26_InvokeCompletion:
line    1:
Traceback (most recent call last):
Error detected while processing function <SNR>26_OnTextChangedInsertMode[26]..<SNR>26_InvokeCompletion:
line    1:
  File "<string>", line 1, in <module>
Error detected while processing function <SNR>26_OnTextChangedInsertMode[26]..<SNR>26_InvokeCompletion:
line    1:
  File "/Users/yous/.vim/plugged/tabnine-vim/autoload/../python/ycm/youcompleteme.py", line 299, in SendCompletionRequest
Error detected while processing function <SNR>26_OnTextChangedInsertMode[26]..<SNR>26_InvokeCompletion:
line    1:
    self._latest_completion_request.Start()
Error detected while processing function <SNR>26_OnTextChangedInsertMode[26]..<SNR>26_InvokeCompletion:
line    1:
  File "/Users/yous/.vim/plugged/tabnine-vim/autoload/../python/ycm/client/omni_completion_request.py", line 35, in Start
Error detected while processing function <SNR>26_OnTextChangedInsertMode[26]..<SNR>26_InvokeCompletion:
line    1:
    self._results = self._omni_completer.ComputeCandidates( self.request_data )
Press ENTER or type command to continue
Error detected while processing function <SNR>26_OnTextChangedInsertMode[26]..<SNR>26_InvokeCompletion:
line    1:
  File "/Users/yous/.vim/plugged/tabnine-vim/autoload/../python/ycm/omni_completer.py", line 71, in ComputeCandidates
Press ENTER or type command to continue
Error detected while processing function <SNR>26_OnTextChangedInsertMode[26]..<SNR>26_InvokeCompletion:
line    1:
    return super( OmniCompleter, self ).ComputeCandidates( request_data )
Press ENTER or type command to continue
Error detected while processing function <SNR>26_OnTextChangedInsertMode[26]..<SNR>26_InvokeCompletion:
line    1:
  File "/Users/yous/.vim/plugged/tabnine-vim/autoload/../third_party/ycmd/ycmd/completers/completer.py", line 231, in ComputeCandidates
Error detected while processing function <SNR>26_OnTextChangedInsertMode[26]..<SNR>26_InvokeCompletion:
line    1:
    candidates = self._GetCandidatesFromSubclass( request_data )
Error detected while processing function <SNR>26_OnTextChangedInsertMode[26]..<SNR>26_InvokeCompletion:
line    1:
  File "/Users/yous/.vim/plugged/tabnine-vim/autoload/../third_party/ycmd/ycmd/completers/completer.py", line 242, in _GetCandidatesFromSubclass
Error detected while processing function <SNR>26_OnTextChangedInsertMode[26]..<SNR>26_InvokeCompletion:
line    1:
    raw_completions = self.ComputeCandidatesInner( request_data )
Error detected while processing function <SNR>26_OnTextChangedInsertMode[26]..<SNR>26_InvokeCompletion:
line    1:
  File "/Users/yous/.vim/plugged/tabnine-vim/autoload/../python/ycm/omni_completer.py", line 118, in ComputeCandidatesInner
Error detected while processing function <SNR>26_OnTextChangedInsertMode[26]..<SNR>26_InvokeCompletion:
line    1:
    items = vim.eval( ''.join( omnifunc_call ) )
Error detected while processing function <SNR>26_OnTextChangedInsertMode[26]..<SNR>26_InvokeCompletion:
line    1:
KeyboardInterrupt
Error detected while processing function <SNR>26_OnTextChangedInsertMode[26]..<SNR>26_InvokeCompletion[4]..<SNR>26_PollCompletion[8]..<SNR>26_Pyeval:
line    2:
Traceback (most recent call last):
Error detected while processing function <SNR>26_OnTextChangedInsertMode[26]..<SNR>26_InvokeCompletion[4]..<SNR>26_PollCompletion[8]..<SNR>26_Pyeval:
line    2:
  File "<string>", line 1, in <module>
Error detected while processing function <SNR>26_OnTextChangedInsertMode[26]..<SNR>26_InvokeCompletion[4]..<SNR>26_PollCompletion[8]..<SNR>26_Pyeval:
line    2:
  File "/Users/yous/.vim/plugged/tabnine-vim/autoload/../python/ycm/youcompleteme.py", line 313, in GetCompletionResponse
Error detected while processing function <SNR>26_OnTextChangedInsertMode[26]..<SNR>26_InvokeCompletion[4]..<SNR>26_PollCompletion[8]..<SNR>26_Pyeval:
line    2:
    response = self._latest_completion_request.Response()
Error detected while processing function <SNR>26_OnTextChangedInsertMode[26]..<SNR>26_InvokeCompletion[4]..<SNR>26_PollCompletion[8]..<SNR>26_Pyeval:
line    2:
  File "/Users/yous/.vim/plugged/tabnine-vim/autoload/../python/ycm/client/omni_completion_request.py", line 51, in Response
Error detected while processing function <SNR>26_OnTextChangedInsertMode[26]..<SNR>26_InvokeCompletion[4]..<SNR>26_PollCompletion[8]..<SNR>26_Pyeval:
line    2:
    'completions': self._results,
Error detected while processing function <SNR>26_OnTextChangedInsertMode[26]..<SNR>26_InvokeCompletion[4]..<SNR>26_PollCompletion[8]..<SNR>26_Pyeval:
line    2:
AttributeError: 'OmniCompletionRequest' object has no attribute '_results'
Error detected while processing function <SNR>26_OnTextChangedInsertMode[26]..<SNR>26_InvokeCompletion[4]..<SNR>26_PollCompletion[8]..<SNR>26_Pyeval:
line    2:
E858: Eval did not return a valid python object
Error detected while processing function <SNR>26_OnTextChangedInsertMode[26]..<SNR>26_InvokeCompletion[4]..<SNR>26_PollCompletion:
line    9:
E121: Undefined variable: completion_start_column
Error detected while processing function <SNR>26_OnTextChangedInsertMode[26]..<SNR>26_InvokeCompletion[4]..<SNR>26_PollCompletion:
line    9:
E15: Invalid expression: {   'start_column': response.completion_start_column,   'candidates': response.completions }

This is related to YCM semantic trigger. When I add custom semantic triggers to invoke on every word longer than or equal to 4 letters:

let g:ycm_semantic_triggers = {
      \ 'c': ['re![_a-zA-Z]\w{3,}'],
      \ 'cpp': ['re![_a-zA-Z]\w{3,}'] }

Press o on line 279, and type bb_note, one space, and one backspace, then Vim hangs.