ycm-core / YouCompleteMe

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

YCM failures using ACK.VIM #3420

Closed Grueslayer closed 5 years ago

Grueslayer 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:

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

Provide a clear description of the problem, including the following key questions:

Using the plugin "ack.vim" and calling any Ack command will produce many error messages

Include steps to reproduce here.

:Ack "xxxx"

Include description of a minimal test case, including any actual code required to reproduce the issue.

Plug 'mileszs/ack.vim'
let g:ackprg = 'pt --nocolor --nogroup --smart-case'

Include description of the expected behaviour.

No error messages

Include description of the observed behaviour, including actual output, screenshots, etc.

Messages maintainer: Bram Moolenaar <Bram@vim.org>
Error detected while processing function <SNR>138_ReceiveMessages[1]..<SNR>138_Pyeval:
line    4:
Traceback (most recent call last):
    Error detected while processing function <SNR>138_ReceiveMessages[1]..<SNR>138_Pyeval:
    line    4:
      File "<string>", line 1, in <module>
    Error detected while processing function <SNR>138_ReceiveMessages[1]..<SNR>138_Pyeval:
    line    4:
      File "C:\Users\jst.AMS\vimfiles\bundle\YouCompleteMe-Win32\python\ycm\youcompleteme.py", line 435, in OnPeriodicTick
    Error detected while processing function <SNR>138_ReceiveMessages[1]..<SNR>138_Pyeval:
    line    4:
        self._message_poll_request = MessagesPoll()
    Error detected while processing function <SNR>138_ReceiveMessages[1]..<SNR>138_Pyeval:
    line    4:
      File "C:\Users\jst.AMS\vimfiles\bundle\YouCompleteMe-Win32\python\ycm\client\messages_request.py", line 39, in __init__
    Error detected while processing function <SNR>138_ReceiveMessages[1]..<SNR>138_Pyeval:
    line    4:
        self._request_data = BuildRequestData()
    Error detected while processing function <SNR>138_ReceiveMessages[1]..<SNR>138_Pyeval:
    line    4:
      File "C:\Users\jst.AMS\vimfiles\bundle\YouCompleteMe-Win32\python\ycm\client\base_request.py", line 234, in BuildRequestData
    Error detected while processing function <SNR>138_ReceiveMessages[1]..<SNR>138_Pyeval:
    line    4:
        current_filepath )
    Error detected while processing function <SNR>138_ReceiveMessages[1]..<SNR>138_Pyeval:
    line    4:
      File "C:\Users\jst.AMS\vimfiles\bundle\YouCompleteMe-Win32\python\ycm\vimsupport.py", line 152, in GetUnsavedAndSpecifiedBufferData
    Error detected while processing function <SNR>138_ReceiveMessages[1]..<SNR>138_Pyeval:
    line    4:
        buffers_data = { included_filepath: GetBufferData( included_buffer ) }
        Error detected while processing function <SNR>138_ReceiveMessages[1]..<SNR>138_Pyeval:
        line    4:
          File "C:\Users\jst.AMS\vimfiles\bundle\YouCompleteMe-Win32\python\ycm\vimsupport.py", line 143, in GetBufferData
          Error detected while processing function <SNR>138_ReceiveMessages[1]..<SNR>138_Pyeval:
          line    4:
              'contents': JoinLinesAsUnicode( buffer_object ) + '\n',
              Error detected while processing function <SNR>138_ReceiveMessages[1]..<SNR>138_Pyeval:
              line    4:
                File "C:\Users\jst.AMS\vimfiles\bundle\YouCompleteMe-Win32\third_party\ycmd\ycmd\utils.py", line 195, in JoinLinesAsUnicode
                Error detected while processing function <SNR>138_ReceiveMessages[1]..<SNR>138_Pyeval:
                line    4:
                    return ToUnicode( b'\n'.join( lines ) )
                    Error detected while processing function <SNR>138_ReceiveMessages[1]..<SNR>138_Pyeval:
                    line    4:
                      File "C:\Users\jst.AMS\vimfiles\bundle\YouCompleteMe-Win32\third_party\ycmd\ycmd\utils.py", line 179, in ToUnicode
                      Error detected while processing function <SNR>138_ReceiveMessages[1]..<SNR>138_Pyeval:
                      line    4:
                          return str( value, 'utf8' )
                          Error detected while processing function <SNR>138_ReceiveMessages[1]..<SNR>138_Pyeval:
                          line    4:
                            File "C:\Users\jst.AMS\vimfiles\bundle\YouCompleteMe-Win32\third_party\python-future\src\future\types\newstr.py", line 97, in __new__
                            Error detected while processing function <SNR>138_ReceiveMessages[1]..<SNR>138_Pyeval:
                            line    4:
                                value = args[0].decode(*args[1:], **kwargs)
    Error detected while processing function <SNR>138_ReceiveMessages[1]..<SNR>138_Pyeval:
    line    4:
      File "C:\Program Files (x86)\WinPython27\python-2.7.10\Lib\encodings\utf_8.py", line 16, in decode
      Error detected while processing function <SNR>138_ReceiveMessages[1]..<SNR>138_Pyeval:
      line    4:
          return codecs.utf_8_decode(input, errors, True)
    Error detected while processing function <SNR>138_ReceiveMessages[1]..<SNR>138_Pyeval:
    line    4:
    UnicodeDecodeError: 'utf8' codec can't decode byte 0x9e in position 2897: invalid start byte
    Error detected while processing function <SNR>138_ReceiveMessages[1]..<SNR>138_Pyeval:
    line    4:
    E858: Eval did not return a valid python object 

Diagnostic data

Output of vim --version

Place the output here, or a link to a gist.

VIM - Vi IMproved 8.1 (2018 May 18, compiled Jun  2 2019 20:45:33)
    MS-Windows 32-bit GUI/console version with OLE support
    Included patches: 1-1455
    Compiled by stop_@LAPTOP-E7OHISR4
    Huge version with GUI.  Features included (+) or not (-):
        +acl                +browse             +cmdline_compl      +cursorbind         -ebcdic             +find_in_path       +insert_expand      +linebreak          +modify_fname       +num64              +printer            +ruby/dyn           +syntax             -termresponse       +user_commands      +vreplace           -xim
         +arabic             ++builtin_terms     +cmdline_hist       +cursorshape        +emacs_tags         +float              +job                +lispindent         +mouse              +ole                +profile            +scrollbind         +tag_binary         +textobjects        +vartabs            +vtp                +xpm_w32
         +autocmd            +byte_offset        +cmdline_info       +dialog_con_gui     +eval               +folding            +jumplist           +listcmds           +mouseshape         +packages           +python/dyn         +signs              -tag_old_static     +textprop           +vertsplit          +wildignore         -xterm_save
         +autochdir          +channel            +comments           +diff               +ex_extra           -footer             +keymap             +localmap           +multi_byte_ime/dyn +path_extra         +python3/dyn        +smartindent        -tag_any_white      -tgetent            +virtualedit        +wildmenu           
         +autoservername     +cindent            +conceal            +digraphs           +extra_search       +gettext/dyn        +lambda             +lua/dyn            +multi_lang         +perl/dyn           +quickfix           +startuptime        +tcl/dyn            +timers             +visual             +windows            
         +balloon_eval       +clientserver       +cryptv             +directx            -farsi              -hangul_input       +langmap            +menu               +mzscheme/dyn       +persistent_undo    +reltime            +statusline         +termguicolors      +title              +visualextra        +writebackup        
         +balloon_eval_term  +clipboard          +cscope             -dnd                +file_in_path       +iconv/dyn          +libcall            +mksession          +netbeans_intg      -postscript         +rightleft          -sun_workshop       +terminal           +toolbar            +viminfo            -xfontset           
            system vimrc file: "$VIM\vimrc"
              user vimrc file: "$HOME\_vimrc"
          2nd user vimrc file: "$HOME\vimfiles\vimrc"
          3rd user vimrc file: "$VIM\_vimrc"
               user exrc file: "$HOME\_exrc"
           2nd user exrc file: "$VIM\_exrc"
           system gvimrc file: "$VIM\gvimrc"
             user gvimrc file: "$HOME\_gvimrc"
         2nd user gvimrc file: "$HOME\vimfiles\gvimrc"
         3rd user gvimrc file: "$VIM\_gvimrc"
                defaults file: "$VIMRUNTIME\defaults.vim"
             system menu file: "$VIMRUNTIME\menu.vim"
         Compilation: cl -c /W3 /nologo  -I. -Iproto -DHAVE_PATHDEF -DWIN32  -DFEAT_CSCOPE -DFEAT_TERMINAL -DFEAT_NETBEANS_INTG -DFEAT_JOB_CHANNEL   -DFEAT_XPM_W32   -DWINVER=0x0501 -D_WIN32_WINNT=0x0501 /MP -DHAVE_STDINT_H /Ox /GL -DNDEBUG /arch:IA32 /MD -DVIMDLL -DFEAT_OLE -DFEAT_MBYTE_IME -DDYNAMIC_IME -DGLOBAL_IME -DFEAT_GUI_MSWIN -DFEAT_DIRECTX -DDYNAMIC_DIRECTX -DFEAT_DIRECTX_COLOR_EMOJI -DDYNAMIC_ICONV -DDYNAMIC_GETTEXT -DFEAT_TCL -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"tcl86.dll\" -DDYNAMIC_TCL_VER=\"8.6\" -DFEAT_LUA -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua53.dll\" -DFEAT_PYTHON -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python27.dll\" -DFEAT_PYTHON3 -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"python37.dll\" -DFEAT_MZSCHEME -I "..\..\libs\racket-7.3\include" -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"libracketxxxxxxx.dll\" -DDYNAMIC_MZGC_DLL=\"libmzgcxxxxxxx.dll\" -DFEAT_PERL -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl530.dll\" -DFEAT_RUBY -DDYNAMIC_RUBY -DDYNAMIC_RUBY_VER=26 -DDYNAMIC_RUBY_DLL=\"msvcrt-ruby260.dll\" -DFEAT_HUGE /Fd.\ObjDXOULYHTRZVi386/ /Zi
         Linking: link  /nologo /opt:ref /LTCG:STATUS /d2:-AllowCompatibleILVersions oldnames.lib kernel32.lib advapi32.lib shell32.lib gdi32.lib  comdlg32.lib ole32.lib netapi32.lib uuid.lib /machine:i386 gdi32.lib version.lib   winspool.lib comctl32.lib advapi32.lib shell32.lib netapi32.lib  /machine:i386  msvcrt.lib oleaut32.lib user32.lib  /nodefaultlib:lua53.lib  /STACK:8388608  /nodefaultlib:python27.lib /nodefaultlib:python37.lib   "..\..\libs\IronTcl\x86\lib\tclstub86.lib" WSock32.lib .\xpm\x86\lib-vc14\libXpm.lib /PDB:vim32.pdb -debug

Output of YcmDebugInfo

Place the output here, or a link to a gist.

    Printing YouCompleteMe debug information...
    -- Client logfile: c:\users\jst.ams\appdata\local\temp\ycm_bjf5xo.log
    -- Server Python interpreter: C:\PROGRA~2\WINPYT~2\PYTHON~1.10\python.exe
    -- Server Python version: 2.7.10
    -- Server has Clang support compiled in: True
    -- Clang version: clang version 8.0.0 (tags/RELEASE_800/final)
    -- No extra configuration file found
    -- Server running at: http://127.0.0.1:55367
    -- Server process ID: 19916
    -- Server logfiles:
    --   c:\users\jst.ams\appdata\local\temp\ycmd_55367_stdout_j2kqtd.log
    --   c:\users\jst.ams\appdata\local\temp\ycmd_55367_stderr_dhs5lw.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-06-14 12:38:19,417 - ERROR - HTTPConnectionPool(host='127.0.0.1', port=55367): Max retries exceeded with url: /ready (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x13F89EB0>, 'Connection to 127.0.0.1 timed out. (connect timeout=0.01)'))
serving on http://PC-JST-NEU.ams.local:55367
2019-06-14 12:38:19,526 - INFO - Received ready request
2019-06-14 12:38:19,582 - INFO - Received event notification
2019-06-14 12:38:19,582 - ERROR - Semantic completion not available for ['startify']
Traceback (most recent call last):
  File "C:\Users\jst.AMS\vimfiles\bundle\YOUCOM~1\THIRD_~1\ycmd\ycmd\server_state.py", line 98, in FiletypeCompletionAvailable
    self.GetFiletypeCompleter( filetypes )
  File "C:\Users\jst.AMS\vimfiles\bundle\YOUCOM~1\THIRD_~1\ycmd\ycmd\server_state.py", line 87, in GetFiletypeCompleter
    current_filetypes ) )
ValueError: No semantic completer exists for filetypes: ['startify']
2019-06-14 12:38:19,585 - INFO - Received event notification
2019-06-14 12:38:19,588 - INFO - Adding buffer identifiers for file: C:\Program Files (x86)\Vim\vim81\1
2019-06-14 12:38:19,589 - ERROR - Semantic completion not available for ['startify']
Traceback (most recent call last):
  File "C:\Users\jst.AMS\vimfiles\bundle\YOUCOM~1\THIRD_~1\ycmd\ycmd\server_state.py", line 98, in FiletypeCompletionAvailable
    self.GetFiletypeCompleter( filetypes )
  File "C:\Users\jst.AMS\vimfiles\bundle\YOUCOM~1\THIRD_~1\ycmd\ycmd\server_state.py", line 87, in GetFiletypeCompleter
    current_filetypes ) )
ValueError: No semantic completer exists for filetypes: ['startify']
2019-06-14 12:38:19,694 - INFO - Received filetype completion available request
2019-06-14 12:38:19,696 - ERROR - Semantic completion not available for ['startify']
Traceback (most recent call last):
  File "C:\Users\jst.AMS\vimfiles\bundle\YOUCOM~1\THIRD_~1\ycmd\ycmd\server_state.py", line 98, in FiletypeCompletionAvailable
    self.GetFiletypeCompleter( filetypes )
  File "C:\Users\jst.AMS\vimfiles\bundle\YOUCOM~1\THIRD_~1\ycmd\ycmd\server_state.py", line 87, in GetFiletypeCompleter
    current_filetypes ) )
ValueError: No semantic completer exists for filetypes: ['startify']
2019-06-14 12:38:50,319 - INFO - Received event notification
2019-06-14 12:38:50,319 - ERROR - Semantic completion not available for ['startify']
Traceback (most recent call last):
  File "C:\Users\jst.AMS\vimfiles\bundle\YOUCOM~1\THIRD_~1\ycmd\ycmd\server_state.py", line 98, in FiletypeCompletionAvailable
    self.GetFiletypeCompleter( filetypes )
  File "C:\Users\jst.AMS\vimfiles\bundle\YOUCOM~1\THIRD_~1\ycmd\ycmd\server_state.py", line 87, in GetFiletypeCompleter
    current_filetypes ) )
ValueError: No semantic completer exists for filetypes: ['startify']
2019-06-14 12:38:50,382 - INFO - Received event notification
2019-06-14 12:38:50,384 - ERROR - Semantic completion not available for ['help']
Traceback (most recent call last):
  File "C:\Users\jst.AMS\vimfiles\bundle\YOUCOM~1\THIRD_~1\ycmd\ycmd\server_state.py", line 98, in FiletypeCompletionAvailable
    self.GetFiletypeCompleter( filetypes )
  File "C:\Users\jst.AMS\vimfiles\bundle\YOUCOM~1\THIRD_~1\ycmd\ycmd\server_state.py", line 87, in GetFiletypeCompleter
    current_filetypes ) )
ValueError: No semantic completer exists for filetypes: ['help']
2019-06-14 12:38:50,384 - INFO - Received event notification
2019-06-14 12:38:50,385 - INFO - Adding buffer identifiers for file: C:\Program Files (x86)\Vim\vim81\doc\visual.txt
2019-06-14 12:38:50,397 - ERROR - Semantic completion not available for ['help']
Traceback (most recent call last):
  File "C:\Users\jst.AMS\vimfiles\bundle\YOUCOM~1\THIRD_~1\ycmd\ycmd\server_state.py", line 98, in FiletypeCompletionAvailable
    self.GetFiletypeCompleter( filetypes )
  File "C:\Users\jst.AMS\vimfiles\bundle\YOUCOM~1\THIRD_~1\ycmd\ycmd\server_state.py", line 87, in GetFiletypeCompleter
    current_filetypes ) )
ValueError: No semantic completer exists for filetypes: ['help']
2019-06-14 12:39:01,930 - INFO - Received filetype completion available request
2019-06-14 12:39:01,931 - ERROR - Semantic completion not available for ['help']
Traceback (most recent call last):
  File "C:\Users\jst.AMS\vimfiles\bundle\YOUCOM~1\THIRD_~1\ycmd\ycmd\server_state.py", line 98, in FiletypeCompletionAvailable
    self.GetFiletypeCompleter( filetypes )
  File "C:\Users\jst.AMS\vimfiles\bundle\YOUCOM~1\THIRD_~1\ycmd\ycmd\server_state.py", line 87, in GetFiletypeCompleter
    current_filetypes ) )
ValueError: No semantic completer exists for filetypes: ['help']
2019-06-14 12:39:44,650 - INFO - Received debug info request
2019-06-14 12:39:44,651 - ERROR - Error retrieving completer debug info
Traceback (most recent call last):
  File "C:\Users\jst.AMS\vimfiles\bundle\YOUCOM~1\THIRD_~1\ycmd\ycmd\handlers.py", line 234, in DebugInfo
    request_data ).DebugInfo( request_data )
  File "C:\Users\jst.AMS\vimfiles\bundle\YOUCOM~1\THIRD_~1\ycmd\ycmd\handlers.py", line 298, in _GetCompleterForRequestData
    return _server_state.GetFiletypeCompleter( request_data[ 'filetypes' ] )
  File "C:\Users\jst.AMS\vimfiles\bundle\YOUCOM~1\THIRD_~1\ycmd\ycmd\server_state.py", line 87, in GetFiletypeCompleter
    current_filetypes ) )
ValueError: No semantic completer exists for filetypes: ['help']

OS version, distribution, etc.

Include system information here.

OS Name Microsoft Windows 10 Enterprise
Version 10.0.18362 Build 18362

Output of build/install commands

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

bstaletic commented 5 years ago

From your log:

UnicodeDecodeError: 'utf8' codec can't decode byte 0x9e in position 2897: invalid start byte

YCM simply doesn't and most likely will not support non-UTF-8 encodings.

For further info please read https://github.com/Valloric/YouCompleteMe/issues/3065 (or any other discussing non-UTF-8 encoding).

Grueslayer commented 5 years ago

Vim Encoding is UFT8! There are only 2 buffers open. The file with the first hit, which is correctly loaded and has correct fileencoding, buffer ist utf8. Second the quickfix buffer, which is also UTF8 and has some wrong encoding characters (because pt cant autodetect the correct encoding).

B U T: the Quickfix window is on my blacklist and has not to be searched by YCM

bstaletic commented 5 years ago

the Quickfix window is on my blacklist and has not to be searched by YCM

That's a key information you missed in your first post. Try to apply this patch and see if it works.

diff --git a/autoload/youcompleteme.vim b/autoload/youcompleteme.vim
index b4e0ef8c..7682da8d 100644
--- a/autoload/youcompleteme.vim
+++ b/autoload/youcompleteme.vim
@@ -94,6 +94,10 @@ endfunction

 function! s:ReceiveMessages( timer_id )
+  if !s:AllowedToCompleteInCurrentBuffer()
+    return
+  endif
+
   let poll_again = s:Pyeval( 'ycm_state.OnPeriodicTick()' )

   if poll_again
Grueslayer commented 5 years ago

Hi, i would have given you this info if I knew it earlier. I had examined the problem more after you'd written the comment.

Your patch fixes the problem for me.