ycm-core / YouCompleteMe

A code-completion engine for Vim
http://ycm-core.github.io/YouCompleteMe/
GNU General Public License v3.0
25.43k stars 2.81k forks source link

Omnisharp + YCM autocompletion errors #1915

Closed Stewmath closed 8 years ago

Stewmath commented 8 years ago

I'm getting errors whenever I type a letter after the autocompleter comes up.

Error detected while processing function <SNR>50_OnCompleteDone:
line    1:
  File "~/.vim/bundle/YouCompleteMe/autoload/../python/ycm/youcompleteme.py", line 304, in OnCompleteDone
Press ENTER or type command to continue
Error detected while processing function <SNR>50_OnCompleteDone:
line    1:
    action(self)

Removing the offending lines in this function actually seems to fix the issue, and the autocompleter works, though I've got no idea what functionality I'm disabling. I'm not sure how to debug further. This is the function I disabled.

def OnCompleteDone( self ):
    complete_done_actions = self.GetCompleteDoneHooks()
    for action in complete_done_actions:
      action(self)
Stewmath commented 8 years ago

A bit more information. My log after autocomplete goes crazy:

2016-01-15 21:24:59,949 - DEBUG - No global extra conf, not calling method YcmCorePreload
2016-01-15 21:25:00,410 - INFO - Received event notification
2016-01-15 21:25:00,411 - DEBUG - Event name: BufferVisit
2016-01-15 21:25:00,417 - INFO - Received event notification
2016-01-15 21:25:00,418 - DEBUG - Event name: FileReadyToParse
2016-01-15 21:25:00,418 - INFO - Adding buffer identifiers for file: /file.cs
2016-01-15 21:25:00,753 - INFO - Received health request
2016-01-15 21:25:00,755 - INFO - Received filetype completion available request
2016-01-15 21:25:05,847 - INFO - Received event notification
2016-01-15 21:25:05,847 - DEBUG - Event name: FileReadyToParse
2016-01-15 21:25:05,847 - INFO - Adding buffer identifiers for file: /file.cs
2016-01-15 21:25:05,962 - INFO - Received completion request
2016-01-15 21:25:05,962 - DEBUG - Using filetype completion: False
2016-01-15 21:25:06,082 - INFO - Received completion request
2016-01-15 21:25:06,082 - DEBUG - Using filetype completion: False
2016-01-15 21:25:06,130 - INFO - Received completion request
2016-01-15 21:25:06,130 - DEBUG - Using filetype completion: False
2016-01-15 21:25:06,274 - INFO - Received completion request
2016-01-15 21:25:06,275 - DEBUG - Using filetype completion: False
2016-01-15 21:25:06,362 - INFO - Received completion request
2016-01-15 21:25:06,362 - DEBUG - Using filetype completion: False
2016-01-15 21:25:06,506 - INFO - Received completion request
2016-01-15 21:25:06,507 - DEBUG - Using filetype completion: False
2016-01-15 21:25:06,626 - INFO - Received completion request
2016-01-15 21:25:06,626 - DEBUG - Using filetype completion: False
2016-01-15 21:25:06,730 - INFO - Received event notification
2016-01-15 21:25:06,730 - DEBUG - Event name: CurrentIdentifierFinished
2016-01-15 21:25:06,730 - INFO - Adding ONE buffer identifier for file: /file.cs
2016-01-15 21:25:11,872 - INFO - Received event notification
2016-01-15 21:25:11,872 - DEBUG - Event name: FileReadyToParse
2016-01-15 21:25:11,872 - INFO - Adding buffer identifiers for file: /file.cs
2016-01-15 21:25:11,873 - INFO - Received event notification
2016-01-15 21:25:11,874 - DEBUG - Event name: InsertLeave
2016-01-15 21:25:11,874 - INFO - Adding ONE buffer identifier for file: /file.cs
2016-01-15 21:25:12,863 - INFO - Received event notification
2016-01-15 21:25:12,863 - DEBUG - Event name: FileReadyToParse
2016-01-15 21:25:12,863 - INFO - Adding buffer identifiers for file: /file.cs
2016-01-15 21:25:12,864 - INFO - Received event notification
2016-01-15 21:25:12,864 - DEBUG - Event name: InsertLeave
2016-01-15 21:25:18,737 - INFO - Received debug info request
2016-01-15 21:25:22,380 - INFO - Received event notification
2016-01-15 21:25:22,380 - DEBUG - Event name: FileReadyToParse
2016-01-15 21:25:22,381 - INFO - Adding buffer identifiers for file: /file.cs
2016-01-15 21:25:24,945 - INFO - Received debug info request
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jan  8 2016 13:14:16)
Included patches: 1-1063
Compiled by Arch Linux
Huge version with GTK2 GUI.  Features included (+) or not (-):
+acl             +farsi           +mouse_netterm   +syntax
+arabic          +file_in_path    +mouse_sgr       +tag_binary
+autocmd         +find_in_path    -mouse_sysmouse  +tag_old_static
+balloon_eval    +float           +mouse_urxvt     -tag_any_white
+browse          +folding         +mouse_xterm     -tcl
++builtin_terms  -footer          +multi_byte      +terminfo
+byte_offset     +fork()          +multi_lang      +termresponse
+cindent         +gettext         -mzscheme        +textobjects
+clientserver    -hangul_input    +netbeans_intg   +title
+clipboard       +iconv           +path_extra      +toolbar
+cmdline_compl   +insert_expand   +perl/dyn        +user_commands
+cmdline_hist    +jumplist        +persistent_undo +vertsplit
+cmdline_info    +keymap          +postscript      +virtualedit
+comments        +langmap         +printer         +visual
+conceal         +libcall         +profile         +visualextra
+cryptv          +linebreak       +python/dyn      +viminfo
+cscope          +lispindent      +python3/dyn     +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con_gui  +lua/dyn         +rightleft       +windows
+diff            +menu            +ruby/dyn        +writebackup
+digraphs        +mksession       +scrollbind      +X11
+dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     +xim
+emacs_tags      +mouseshape      -sniff           +xsmp_interact
+eval            +mouse_dec       +startuptime     +xterm_clipboard
+ex_extra        +mouse_gpm       +statusline      -xterm_save
+extra_search    -mouse_jsbterm   -sun_workshop    -xpm
   system vimrc file: "/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "/etc/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libdrm -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -D_FORTIFY_SOURCE=2  -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -L. -Wl,-O1,--sort-common,--as-needed,-z,relro -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-rpath,/usr/lib/perl5/core_perl/CORE  -Wl,-O1,--sort-common,--as-needed,-z,relro -L/usr/local/lib -Wl,--as-needed -o vim   -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype -lSM -lICE -lXt -lX11 -lXdmcp -lSM -lICE  -lm -lncurses -lelf -lnsl    -lacl -lattr -lgpm -ldl   -Wl,-E -Wl,-rpath,/usr/lib/perl5/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro -fstack-protector-strong -L/usr/local/lib  -L/usr/lib/perl5/core_perl/CORE -lperl -lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
puremourning commented 8 years ago

@Drenn1 in the first post, are you sure you included the whole message? If you did :messages was there more of a trace back? It isn't obvious what is up here from the available context.

It would help to get a small reproducible test case.

The function that you are 'missing' is the ability in c-sharp files to automatically insert import declarations when selecting completions. See this PR for details.

mispencer commented 8 years ago

@Drenn1 Can you check if https://github.com/Valloric/YouCompleteMe/pull/1916 fixes these errors?

Stewmath commented 8 years ago

I thought the error messages were just repeating themselves, so I only included a portion, but here's the full thing. Might be more useful than I realized.

Error detected while processing function <SNR>50_OnCompleteDone:
line    1:
Traceback (most recent call last):
Press ENTER or type command to continue
Error detected while processing function <SNR>50_OnCompleteDone:
line    1:
  File "<string>", line 1, in <module>
Press ENTER or type command to continue
Error detected while processing function <SNR>50_OnCompleteDone:
line    1:
  File "/home/matthew/linux-config/.vim/bundle/YouCompleteMe/autoload/../python/ycm/youcompleteme.py", line 304, in OnCompleteDone
Press ENTER or type command to continue
Error detected while processing function <SNR>50_OnCompleteDone:
line    1:
    action(self)
Press ENTER or type command to continue
Error detected while processing function <SNR>50_OnCompleteDone:
line    1:
  File "/home/matthew/linux-config/.vim/bundle/YouCompleteMe/autoload/../python/ycm/youcompleteme.py", line 102, in <lambda>
Press ENTER or type command to continue
Error detected while processing function <SNR>50_OnCompleteDone:
line    1:
    'cs': lambda( self ): self._OnCompleteDone_Csharp()
Press ENTER or type command to continue
Error detected while processing function <SNR>50_OnCompleteDone:
line    1:
  File "/home/matthew/linux-config/.vim/bundle/YouCompleteMe/autoload/../python/ycm/youcompleteme.py", line 427, in _OnCompleteDone_C
sharp
Press ENTER or type command to continue
Error detected while processing function <SNR>50_OnCompleteDone:
line    1:
    completions = self.GetCompletionsUserMayHaveCompleted()
Press ENTER or type command to continue
Error detected while processing function <SNR>50_OnCompleteDone:
line    1:
  File "/home/matthew/linux-config/.vim/bundle/YouCompleteMe/autoload/../python/ycm/youcompleteme.py", line 319, in GetCompletionsUse
rMayHaveCompleted
Press ENTER or type command to continue
Error detected while processing function <SNR>50_OnCompleteDone:
line    1:
    completions = latest_completion_request.RawResponse()
Press ENTER or type command to continue
Error detected while processing function <SNR>50_OnCompleteDone:
line    1:
  File "/home/matthew/linux-config/.vim/bundle/YouCompleteMe/autoload/../python/ycm/client/completion_request.py", line 45, in RawRes
ponse
Press ENTER or type command to continue
Error detected while processing function <SNR>50_OnCompleteDone:
line    1:
    if not self._response_future:
Press ENTER or type command to continue
Error detected while processing function <SNR>50_OnCompleteDone:
line    1:
AttributeError: 'OmniCompletionRequest' object has no attribute '_response_future'

mispencer, that does fix it. Thanks :)

Stewmath commented 8 years ago

I've got a test case if you still want to look at it. https://gist.github.com/Drenn1/d5eb9765d8b0013cd189

I have, of course, pathogen installed, with omnisharp-vim and YouCompleteMe in the bundle folder.

puremourning commented 8 years ago

So you're not using YCM's omnisharp completer, but just the omnifunc integration?

@mispencer that sounds like we shouldn't be executing these completion done commands when c-sharp isn't a semantic-enabled language ?

Stewmath commented 8 years ago

Autocompletion is working with that pull request, if that's what you're asking. Though I might not be understanding the question correctly.

puremourning commented 8 years ago

I was asking if you were using YCM's own semantic engine for C-sharp completions. That is: did you pass --omnisharp-completer to install.py when you built YCM ?

FWIW YCM's own completers typically offer a much better experience that any alternate plugin via the omnifunc.

Stewmath commented 8 years ago

I see, so they have their own versions of that functionality? I did not pass that before, I'd previously built it for c++. Though I apologize since that was clearly in the readme. It seems like that fixes the issue as well, along with commenting out omnifunc=OmniSharp#complete.

puremourning commented 8 years ago

No need to apologise :) I hope your YCM experience is improved by the c-sharp completer. Such as the auto-import of namespaces :) :grin:

micbou commented 8 years ago

Fixed by PR #1916.