Closed SimonDaNinja closed 4 years ago
Thanks for the bug report. I can reproduce the issue.
As a workaround, you can execute :YcmForceCompileAndDiagnostics
to refresh.
Here's a patch that fixes the bug, but tests are still missing:
diff --git a/autoload/youcompleteme.vim b/autoload/youcompleteme.vim
index 18aed539..9bbd66f0 100644
--- a/autoload/youcompleteme.vim
+++ b/autoload/youcompleteme.vim
@@ -604,13 +604,13 @@ endfunction
function! s:OnBufferEnter()
+ call s:StartMessagePoll()
if !s:VisitedBufferRequiresReparse()
return
endif
call s:SetUpCompleteopt()
call s:SetCompleteFunc()
- call s:StartMessagePoll()
exec s:python_command "ycm_state.OnBufferVisit()"
" Last parse may be outdated because of changes from other buffers. Force a
Patch LGTM; we can merge it without tests if it fixes the issue then add a test in another PR.
It does fix the issue. @puremourning Feel free to push to master, I'll be away today.
Here's a patch that fixes the bug, but tests are still missing:
diff --git a/autoload/youcompleteme.vim b/autoload/youcompleteme.vim index 18aed539..9bbd66f0 100644 --- a/autoload/youcompleteme.vim +++ b/autoload/youcompleteme.vim @@ -604,13 +604,13 @@ endfunction function! s:OnBufferEnter() + call s:StartMessagePoll() if !s:VisitedBufferRequiresReparse() return endif call s:SetUpCompleteopt() call s:SetCompleteFunc() - call s:StartMessagePoll() exec s:python_command "ycm_state.OnBufferVisit()" " Last parse may be outdated because of changes from other buffers. Force a
I changed the code accordingly on my local machine, and it definitely solved the issue.
Thank you!
Issue Prelude
Please complete these steps and check these boxes (by putting an
x
inside the brackets) before filing your issue:vim --version
.:YcmDebugInfo
.:YcmToggleLogs
command.install.py
(orcmake
/make
/ninja
) including its invocationThank 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
I'm having issues with Clang diagnostics consistently lagging behind by one step for the rest of the session whenever I have used
:lopen
to see diagnostics in the location list. It is not solved by using:YcmForceCompileAndDiagnostics
; this refreshes the diagnostics, but by the next change I make to the file, diagnostics are lagging behind by one change again.What did you do?
I have
let g:ycm_always_populate_location_list = 1
in my vimrc to be able to view diagnostics in the location list.I edit a .c-file, and initially I get clang diagnostics seamlessly.
I execute
:lopen
and press enter to go to the first diagnostic issue.I execute
:lclose
.I fix the issue, but the issue is still being diagnosed on the same line.
I make a trivial change to the file, e.g. create a new line at the end of the file. Diagnostics treat the issue as solved.
I artificially create a Clang error, e.g. call a non-declared variable. This is not diagnosed
I make a trivial change to the file, e.g. create a new line at the end of the file.
The issue is diagnosed.
Throughout the rest of the vim session, all diagnostics arrive one change later than they should
What did you expect to happen?
I expected diagnostics to continue in sync with the changes made to the file.
Throughout the rest of the session, all diagnostics arrive one change to the file later than they should.
This gif shows how diagnostics first work as intended, but not after
:lopen
Diagnostic data
Output of
vim --version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Oct 28 2019 12:23:44) Included patches: 1-2231 Modified by jonathon.fernyhough@york.ac.uk Compiled by jonathon.fernyhough@york.ac.uk Huge version with GTK3 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 +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/share/vim" Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -pthread -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cairo -I/usr/include/libdrm -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/uuid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -Wdate-time -g -O2 -fdebug-prefix-map=/build/vim-p9CvbR/vim-8.1.2231=. -fstack-protector-strong -Wformat -Werror=format-security -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 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE -lm -ltinfo -lnsl -lselinux -lcanberra -lacl -lattr -lgpm -ldl -L/usr/lib -llua5.2 -Wl,-E -fstack-protector-strong -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu/perl/5.28/CORE -lperl -ldl -lm -lpthread -lcrypt -L/usr/lib/python3.7/config-3.7m-x86_64-linux-gnu -lpython3.7m -lcrypt -lpthread -ldl -lutil -lm -L/usr/lib/x86_64-linux-gnu -ltcl8.6 -ldl -lz -lpthread -lm -lruby-2.5 -lpthread -lgmp -ldl -lcrypt -lm
Output of
YcmDebugInfo
Printing YouCompleteMe debug information... -- Client logfile: /tmp/ycm_354rq8qs.log -- Server Python interpreter: /usr/bin/python3 -- Server Python version: 3.7.3 -- Server has Clang support compiled in: True -- Clang version: clang version 9.0.0 (/home/vagrant/llvm/llvm-9.0.0.src/tools/clang 038587147cf2f97d1c3e677042f69560c65b5bea) -- No extra configuration file found -- C-family completer debug information: -- Clangd running -- Clangd process ID: 19258 -- Clangd executable: ['/home/simondaninja/.vim/bundle/YouCompleteMe/third_party/yc md/third_party/clangd/output/bin/clangd', '-header-insertion-decorators=0', '-resourc e-dir=/home/simondaninja/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/clang /lib/clang/9.0.0', '-limit-results=500', '-log=verbose'] -- Clangd logfiles: -- /tmp/clangd_stderrz1d1zhha.log -- Clangd Server State: Initialized -- Clangd Project Directory: /home/simondaninja -- Clangd Settings: {} -- Clangd Compilation Command: False -- Server running at: http://127.0.0.1:42097 -- Server process ID: 19215 -- Server logfiles: -- /tmp/ycmd_42097_stdout_a1kc4syz.log -- /tmp/ycmd_42097_stderr_b48oos52.log
Contents of YCM, ycmd and completion engine logfiles
Here is a link to gist with logs
OS version, distribution, etc.
Kubuntu 19.04