ycm-core / YouCompleteMe

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

error message on files bigger than 1'000'000 bytes even when ycm is disabled on that filetype #3463

Closed g-i-o-r-g-i-o closed 4 years ago

g-i-o-r-g-i-o commented 5 years ago

Issue Prelude

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

Issue Details

I disabled youcompleteme on certain filetypes, but when the file is too big, I still get an error that says: "youcompleteme has been disabled because the file was too big"

I've added these to my vimrc:

let g:ycm_filetype_blacklist = {'*': 1} let g:ycm_filetype_whitelist = { 'python3': 1, 'vim': 1, }

or in alternative

let g:ycm_filetype_blacklist={'wri': 1, 'notes': 1, 'markdown': 1, 'unite': 1, 'tagbar': 1, 'pandoc': 1, 'qf': 1, 'vimwiki': 1, 'text': 1, 'infolog': 1, 'mail': 1} let g:ycm_filetype_whitelist = { \'python3': 1, \'vim': 1, }

Sometimes I open some big txt files (different from the enabled filetypes) and I still receive the message that youcompleteme has been disabled because the file was too big...

Include steps to reproduce here.

open a file bigger than 1'000'000 bytes

open without errors

I received an error message.

youcompleteme has been disabled because the file was too big

Diagnostic data

Output of vim --version

VIM - Vi IMproved 8.1 (2018 May 18, compiled Jun 17 2019 18:39:40) Included patches: 1-1561 Huge version with GTK2 GUI. Features included (+) or not (-): +acl -farsi -mouse_sysmouse -tag_any_white +arabic +file_in_path +mouse_urxvt -tcl +autocmd +find_in_path +mouse_xterm +termguicolors +autochdir +float +multi_byte +terminal -autoservername +folding +multi_lang +terminfo +balloon_eval -footer -mzscheme +termresponse +balloon_eval_term +fork() +netbeans_intg +textobjects +browse +gettext +num64 +textprop ++builtin_terms -hangul_input +packages +timers +byte_offset +iconv +path_extra +title +channel +insert_expand +perl +toolbar +cindent +job +persistent_undo +user_commands +clientserver +jumplist +postscript +vartabs +clipboard +keymap +printer +vertsplit +cmdline_compl +lambda +profile +virtualedit +cmdline_hist +langmap -python +visual +cmdline_info +libcall +python3 +visualextra +comments +linebreak +quickfix +viminfo +conceal +lispindent +reltime +vreplace +cryptv +listcmds +rightleft +wildignore +cscope +localmap +ruby/dyn +wildmenu +cursorbind +lua +scrollbind +windows +cursorshape +menu +signs +writebackup +dialog_con_gui +mksession +smartindent +X11 +diff +modify_fname +sound -xfontset +digraphs +mouse +spell +xim +dnd +mouseshape +startuptime +xpm -ebcdic +mouse_dec +statusline +xsmp_interact +emacs_tags -mouse_gpm -sun_workshop +xterm_clipboard +eval -mouse_jsbterm +syntax -xterm_save +ex_extra +mouse_netterm +tag_binary
+extra_search +mouse_sgr -tag_old_static
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" defaults file: "$VIMRUNTIME/defaults.vim" system menu file: "$VIMRUNTIME/menu.vim" fall-back for $VIM: "/usr/local/share/vim" Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -g -O2 -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E -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 -lXpm -lXt -lX11 -lXdmcp -lSM -lICE -lm -ltinfo -lnsl -lselinux -lcanberra -ldl -L/usr/lib -llua5.1 -Wl,-E -fstack-protector-strong -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu/perl/5.26/CORE -lperl -ldl -lm -lpthread -lcrypt -L/usr/lib/python3.6/config-3.6m-x86_64-linux-gnu -lpython3.6m -lpthread -ldl -lutil -lm

Output of YcmDebugInfo

Printing YouCompleteMe debug information... -- Client logfile: /tmp/ycm_e5gy4r2o.log -- Server Python interpreter: /usr/bin/python -- Server Python version: 2.7.16 -- Server has Clang support compiled in: False -- Clang version: None -- No extra configuration file found -- Server running at: http://127.0.0.1:49721 -- Server process ID: 19756 -- Server logfiles: -- /tmp/ycmd_49721_stdout_v07m38tq.log -- /tmp/ycmd_49721_stderr_ub9pvyxb.log

Contents of YCM, ycmd and completion engine logfiles

Add let g:ycm_log_level = 'debug' to vimrc, restart Vim, reproduce the issue, and include link here to a gist containing the entire logfiles for ycm, ycmd and any completer logfiles listed by :YcmToggleLogs.

2019-08-04 17:29:18,150 - DEBUG - No global extra conf, not calling method YcmCorePreload 2019-08-04 17:29:18,184 - INFO - Received ready request 2019-08-04 17:29:39,610 - INFO - Received debug info request 2019-08-04 17:29:39,626 - ERROR - Error retrieving completer debug info Traceback (most recent call last): File "/home/username/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/handlers.py", line 234, in DebugInfo request_data ).DebugInfo( request_data ) File "/home/username/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/handlers.py", line 298, in _GetCompleterForRequestData return _server_state.GetFiletypeCompleter( request_data[ 'filetypes' ] ) File "/home/username/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/server_state.py", line 100, in GetFiletypeCompleter current_filetypes ) ) ValueError: No semantic completer exists for filetypes: [u'text'] 2019-08-04 17:29:48,350 - INFO - Received debug info request 2019-08-04 17:29:48,367 - ERROR - Error retrieving completer debug info Traceback (most recent call last): File "/home/username/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/handlers.py", line 234, in DebugInfo request_data ).DebugInfo( request_data ) File "/home/username/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/handlers.py", line 298, in _GetCompleterForRequestData return _server_state.GetFiletypeCompleter( request_data[ 'filetypes' ] ) File "/home/username/.vim/plugged/YouCompleteMe/third_party/ycmd/ycmd/server_state.py", line 100, in GetFiletypeCompleter current_filetypes ) ) ValueError: No semantic completer exists for filetypes: [u'text']

OS version, distribution, etc.

ubuntu 18.10

Output of build/install commands

Include link to a gist containing the invocation and entire output of install.py if reporting an installation issue.

g-i-o-r-g-i-o commented 5 years ago

does anyone else have the same problem?

bstaletic commented 5 years ago

I have just checked. AllowedToCompleteInCurrentBuffer first checks if the file is too large and then the white/black list.

What you can do is set g:ycm_disable_for_files_larger_than_kb to 0 and disable that check.

bstaletic commented 4 years ago

No answer, closing.

g-i-o-r-g-i-o commented 4 years ago

I still get the error that tells me that you complete is disabled in this buffet, the file exceeded the max size

Il giorno sabato 26 ottobre 2019, Boris Staletic notifications@github.com ha scritto:

No answer, closing.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ycm-core/YouCompleteMe/issues/3463?email_source=notifications&email_token=ACG2GHF7ZUPLF7CBG6VXCCTQQPUCDA5CNFSM4IJFTVM2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECKBXLY#issuecomment-546577327, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACG2GHC37DJKVSKZGAA3AJTQQPUCDANCNFSM4IJFTVMQ .

g-i-o-r-g-i-o commented 4 years ago

Ok adding

g:ycm_disable_for_files_larger_than_kb

Fixes the warning

Il giorno sabato 26 ottobre 2019, Boris Staletic notifications@github.com ha scritto:

No answer, closing.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ycm-core/YouCompleteMe/issues/3463?email_source=notifications&email_token=ACG2GHF7ZUPLF7CBG6VXCCTQQPUCDA5CNFSM4IJFTVM2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECKBXLY#issuecomment-546577327, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACG2GHC37DJKVSKZGAA3AJTQQPUCDANCNFSM4IJFTVMQ .

g-i-o-r-g-i-o commented 4 years ago

But does this make sense? I've disabled ycm on specific for types, I get the warning because said option doesn't work as intended, and I need to suppress the warning. This is a broken behaviour, and I don't know what was I supposed you answer about. It's still unfixed for me

Il giorno sabato 26 ottobre 2019, Boris Staletic notifications@github.com ha scritto:

No answer, closing.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ycm-core/YouCompleteMe/issues/3463?email_source=notifications&email_token=ACG2GHF7ZUPLF7CBG6VXCCTQQPUCDA5CNFSM4IJFTVM2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECKBXLY#issuecomment-546577327, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACG2GHC37DJKVSKZGAA3AJTQQPUCDANCNFSM4IJFTVMQ .

puremourning commented 4 years ago

I think this is sufficiently unusual and niche that we're unlikely to spend time on it. But we can leave the issue open in case you fancy sending a properly tested PR.

g-i-o-r-g-i-o commented 4 years ago

Sincerely I don't know what am I supposed to do at this point. I've disabled ycm on all filetypes, and enabled only on some filetypes, yet I see tha warning that tells me that ycm is disabled because the file size is too big, even on the disabled filetypes. I've uploaded all the requested details on the first post? What am I supposed to do now? Can you just post a vimrc configuration that will really disable ycm on the filetypes where is should be disabled, without having to silence the ycm warnings first?

puremourning commented 4 years ago

We are acknowledging there is a bug here. PRs are welcome to fix it.

iysheng commented 4 years ago

does anyone else have the same problem?

I get the problem too when open a text type file (in blacklist default )larger than g:ycm_disable_for_files_larger_than_kb. Error detected while processing function 68_OnCursorMovedNormalMode[1]..68_AllowedToCompleteInCurrentBuffer[1] 68_AllowedToCompleteInBuffer[9]..68_DisableOnLargeFile:

bstaletic commented 4 years ago

That traceback is a different problem completely. It's already fixed, so just update your YCM.

iysheng commented 4 years ago

That traceback is a different problem completely. It's already fixed, so just update your YCM. the full error display:

Error detected while processing function 68_OnCursorMovedNormalMode[1]..68_AllowedToCompleteInCurrentBuffer[1]..68_Allowe dToCompleteInBuffer[9]..68_DisableOnLargeFile: line 9: File "", line 1 Press ENTER or type command to continue Error detected while processing function 68_OnCursorMovedNormalMode[1]..68_AllowedToCompleteInCurrentBuffer[1]..68_Allowe dToCompleteInBuffer[9]..68_DisableOnLargeFile: line 9: vimsupport.PostVimMessage( 'YouCompleteMe is disabled in this buffer;' . ' the file exceeded the max size (see YCM options).' ) Press ENTER or type command to continue Error detected while processing function 68_OnCursorMovedNormalMode[1]..68_AllowedToCompleteInCurrentBuffer[1]..68_Allowe dToCompleteInBuffer[9]..68_DisableOnLargeFile: line 9: ^ Press ENTER or type command to continue Error detected while processing function 68_OnCursorMovedNormalMode[1]..68_AllowedToCompleteInCurrentBuffer[1]..68_Allowe dToCompleteInBuffer[9]..68_DisableOnLargeFile: line 9: SyntaxError: invalid syntax

after i change let g:ycm_disable_for_files_larger_than_kb 4096 ,more than large than the file size,there is no error print anymore. need i create a new issuse ??

puremourning commented 4 years ago

Fixed by #3753