Youcompleteme: Error on vim start up when UltiSnips is not installed

Created on 15 Sep 2016  路  12Comments  路  Source: ycm-core/YouCompleteMe

Issue Prelude

Please complete these steps and check these boxes (by putting an x inside
the brackets) _before_ filing your issue:

  • [x] I have read and understood YCM's CONTRIBUTING document.
  • [x] I have read and understood YCM's CODE_OF_CONDUCT document.
  • [x] I have read and understood YCM's README, especially the
    Frequently Asked Questions section.
  • [x] I have searched YCM's issue tracker to find issues similar to the one I'm
    about to report and couldn't find an answer to my problem. (Example Google
    search.
    )
  • [x] If filing a bug report, I have included the output of vim --version.
  • [x] If filing a bug report, I have included the output of :YcmDebugInfo.
  • [x] If filing a bug report, I have included the output of
    :YcmToggleLogs stderr.
  • [x] If filing a bug report, I have included which OS (including specific OS
    version) I am using.
  • [x] If filing a bug report, I have included a minimal test case that reproduces
    my issue.
  • [x] I understand this is an open-source project staffed by volunteers and
    that any help I receive is a selfless, heartfelt _gift_ of their free time. I
    know I am not entitled to anything and will be polite and courteous.
  • [x] I understand my issue may be closed if it becomes obvious I didn't
    actually perform all of these steps.

Thank you for adhering to this process! It ensures your issue is resolved
quickly and that neither your nor our time is needlessly wasted.

Issue Details

vim version: vim 7.4 ( vim-gtk deb package )
OS: Kubuntu 14.04 LTS

I installed YCM via Vundle and compiled it with --clang-completer --tern-completer. If UltiSnips is not installed, and I start vim with
vim test.c
Errors are shown:

Error detected while processing function youcompleteme#Enable..<SNR>64_OnBufferRead:
line   17:
E117: Unknown function: UltiSnips#SnippetsInCurrentScope
Press ENTER or type command to continue
Error detected while processing function youcompleteme#Enable..<SNR>64_OnBufferRead:
line   17:
E15: Invalid expression: UltiSnips#SnippetsInCurrentScope( 1 )

I tried
let g:ycm_use_ultisnips_completer = 0
but it has no effect on the errors.

These errors goes away after I enable UltiSnips with Vundle.


YcmDebugInfo

Printing YouCompleteMe debug information...
-- Server has Clang support compiled in: True
-- Clang version: clang version 3.9.0 (tags/RELEASE_390/final)
-- C-family completer debug information:
--   Configuration file found and loaded
--   Configuration path: /home/jim/software/etc/ycm_extra_conf.py
--   Flags: ['-g', '-Wall', '-Wextra', '-Wno-unused-variable', '-Wundef', '-std=c++11', '-x', 'c++', '-I', '/home/jim/software/
etc/include', '-I', '/home/jim/software/etc/.', '-isystem', '/home/jim/devel/include', '-isystem', '/home/jim/software/include'
, '-resource-dir=/home/jim/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../clang_includes', '-fspell-checking']
-- Server running at: http://127.0.0.1:32934
-- Server process ID: 10931
-- Server logfiles:
--   /tmp/ycm_temp/server_32934_stdout.log
--   /tmp/ycm_temp/server_32934_stderr.log

YcmToggleLogs stderr

2016-09-16 04:41:47,666 - INFO - Received event notification
2016-09-16 04:41:50,477 - INFO - Received health request
2016-09-16 04:41:50,490 - INFO - Received debug info request

Most helpful comment

@micbou Thanks. That worked.

And for those looking to update Vim using apt-get on Ubuntu Linux, the version won't go beyond 7.40. Do the following to get the latest Vim:
sudo add-apt-repository ppa:pkg-vim/vim-daily
sudo apt-get update
sudo apt-get install vim
dpkg -s vim | grep 'Version' #should be greater than 7.41

Hope it helps.

All 12 comments

Thanks for the detailed and measured report!

I think we've seen this elsewhere, though I personally cannot reproduce it.

I am also getting this issue with the latest version (I don't use UltiSnips). No problem previously. Errors I get:

Error detected while processing function youcompleteme#Enable..<SNR>57_OnBufferRead:
line   17:
E117: Unknown function: UltiSnips#SnippetsInCurrentScope
Press ENTER or type command to continue
Error detected while processing function youcompleteme#Enable..<SNR>57_OnBufferRead:
line   17:
E15: Invalid expression: UltiSnips#SnippetsInCurrentScope( 1 )  

OS: OS X 10.11.6
Vim: 7.4, version output:

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Oct 25 2013 20:05:26)
MacOS X (unix) version
Included patches: 1-52
Compiled by Bjorn Winckler <[email protected]>
Huge version with MacVim GUI.  Features included (+) or not (-):
+acl             +cmdline_info    +emacs_tags      -gettext         -lua             +mouse_urxvt     +profile         +statusline      +transparency    -X11
+arabic          +comments        +eval            -hangul_input    +menu            +mouse_xterm     +python          -sun_workshop    +user_commands   -xfontset
+autocmd         +conceal         +ex_extra        +iconv           +mksession       +multi_byte      -python3         +syntax          +vertsplit       +xim
+balloon_eval    +cryptv          +extra_search    +insert_expand   +modify_fname    +multi_lang      +quickfix        +tag_binary      +virtualedit     -xsmp
+browse          +cscope          +farsi           +jumplist        +mouse           -mzscheme        +reltime         +tag_old_static  +visual          -xterm_clipboard
++builtin_terms  +cursorbind      +file_in_path    +keymap          +mouseshape      +netbeans_intg   +rightleft       -tag_any_white   +visualextra     -xterm_save
+byte_offset     +cursorshape     +find_in_path    +langmap         +mouse_dec       +odbeditor       +ruby            -tcl             +viminfo         -xpm
+cindent         +dialog_con_gui  +float           +libcall         -mouse_gpm       +path_extra      +scrollbind      +terminfo        +vreplace
+clientserver    +diff            +folding         +linebreak       -mouse_jsbterm   +perl            +signs           +termresponse    +wildignore
+clipboard       +digraphs        -footer          +lispindent      +mouse_netterm   +persistent_undo +smartindent     +textobjects     +wildmenu
+cmdline_compl   +dnd             +fork()          +listcmds        +mouse_sgr       +postscript      -sniff           +title           +windows
+cmdline_hist    -ebcdic          +fullscreen      +localmap        -mouse_sysmouse  +printer         +startuptime     +toolbar         +writebackup
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/Applications/MacVim.app/Contents/Resources/vim"
Compilation:
clang -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe  -DMACOS_X_UNIX -no-cpp-precomp  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang   -L. -L/usr/local/lib -L. -L/usr/local/lib  -L/usr/local/lib -o Vim -framework Cocoa -framework Carbon       -lm -lncurses  -liconv -framework Cocoa   -fstack-protector
 -L/usr/local/lib  -L/System/Library/Perl/5.16/darwin-thread-multi-2level/CORE -lperl -framework Python   -framework Ruby

Could you try PR #2337? It should fix the issue.

Thanks, it didn't fix the issue though unfortunately. I pulled the edited file and re-run the install script but still suffer the same error.

I've only had a brief glance so this may not cover all bases but I have been able to continue by using or rather than and (vim.eval( "exists( '*UltiSnips#SnippetsInCurrentScope' )" ) seems to be a good test for whether a user has UltiSnips installed?):

    if ( not vimsupport.VimVersionAtLeast( "7.4.107" ) or
         not vim.eval( "exists( '*UltiSnips#SnippetsInCurrentScope' )" ) ):
      return

That's strange. What is the output of

:py print( vimsupport.VimVersionAtLeast( "7.4.107" ) )

and

:py print( vim.eval( "exists( '*UltiSnips#SnippetsInCurrentScope' )" ) )

in Vim?

Yes:

:py print( vimsupport.VimVersionAtLeast( "7.4.107" ) )
False
:py print( vim.eval( "exists( '*UltiSnips#SnippetsInCurrentScope' )" ) )
0

Intrigued as to how this gets through the and, I tried:

:py print( not vim.eval( "exists( '*UltiSnips#SnippetsInCurrentScope' )" ) )
False

It seems there is some discrepancy over bit and worded logic?! :py print( not vim.eval( "exists( '*UltiSnips#SnippetsInCurrentScope' )" ) ) returns True.

Thanks. It should be fixed now. Could you try again?

Yes GetBoolValue appears to have fixed it, thanks.

I still seem to have the issue. I get the same

Error detected while processing function youcompleteme#Enable..<SNR>14_OnBufferRead:
line   17:
E117: Unknown function: UltiSnips#SnippetsInCurrentScope
Press ENTER or type command to continue
Error detected while processing function youcompleteme#Enable..<SNR>14_OnBufferRead:
line   17:
E15: Invalid expression: UltiSnips#SnippetsInCurrentScope( 1 )
Press ENTER or type command to continue

@tuna-f1sh Can you please let me know how you fixed this? YCM was working fine until the recent update from last week.

@shank7485 Update your Vim version to 7.4.107 or later.

@micbou Thanks. That worked.

And for those looking to update Vim using apt-get on Ubuntu Linux, the version won't go beyond 7.40. Do the following to get the latest Vim:
sudo add-apt-repository ppa:pkg-vim/vim-daily
sudo apt-get update
sudo apt-get install vim
dpkg -s vim | grep 'Version' #should be greater than 7.41

Hope it helps.

Closed as we bumped the minimum Vim version requirement to 7.4.143 with PR #1901. This version contains the patch that fixes this issue.

Was this page helpful?
0 / 5 - 0 ratings