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.81k forks source link

Offer alternatives to populating quickfix when using FixIt #3630

Closed Ram-Z closed 4 years ago

Ram-Z commented 4 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:

I ran :YcmCompleter FixIt and it replaced my quickfix content with a single line telling me I just changed what is in front of my eyes.

I've read README#multi-file-refactor and understand why it might be necessary to populate a list of places where changes were made. But for single line changes this is not necessary and actually harmful as it clobbered my :make output.

Include steps to reproduce here.

This is not very minimal as it interacts with other quickfix providers (namely :make and errorformat), but I hope you understand what I mean. And can reproduce it easily with any setup you have.

  1. :edit test.cpp
  2. :make <- this will fill the quickfix window with build results if errorformat is setup properly
  3. Place cursor on line with a "(fix available)" diagnostic
  4. :YcmCompleter FixIt
  5. See your compilation output in quickfix be clobbered by a single line pointing at exactly where your cursor is.

I've got these ycm related settings. Don't think they are relevant to this issue.

let g:ycm_clangd_binary_path = 'clangd'  " the one provided by ycm seems to crash in my project
let g:ycm_clangd_args = [ '--log=verbose', '--sync' ]  " also crashes without --sync

I expected the FixIt to be applied without replacing the contents of the quickfix window.

quickfix content got replaced by less useful content.

Diagnostic data

Output of vim --version

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Mar  1 2020 17:21:03)
Included patches: 1-343
Compiled by Arch Linux
Huge version with GTK3 GUI.  Features included (+) or not (-):
+acl               -farsi             -mouse_sysmouse    -tag_old_static
+arabic            +file_in_path      +mouse_urxvt       -tag_any_white
+autocmd           +find_in_path      +mouse_xterm       +tcl/dyn
+autochdir         +float             +multi_byte        +termguicolors
-autoservername    +folding           +multi_lang        +terminal
+balloon_eval      -footer            -mzscheme          +terminfo
+balloon_eval_term +fork()            +netbeans_intg     +termresponse
+browse            +gettext           +num64             +textobjects
++builtin_terms    -hangul_input      +packages          +textprop
+byte_offset       +iconv             +path_extra        +timers
+channel           +insert_expand     +perl/dyn          +title
+cindent           +job               +persistent_undo   +toolbar
+clientserver      +jumplist          +popupwin          +user_commands
+clipboard         +keymap            +postscript        +vartabs
+cmdline_compl     +lambda            +printer           +vertsplit
+cmdline_hist      +langmap           +profile           +virtualedit
+cmdline_info      +libcall           +python/dyn        +visual
+comments          +linebreak         +python3/dyn       +visualextra
+conceal           +lispindent        +quickfix          +viminfo
+cryptv            +listcmds          +reltime           +vreplace
+cscope            +localmap          +rightleft         +wildignore
+cursorbind        +lua/dyn           +ruby/dyn          +wildmenu
+cursorshape       +menu              +scrollbind        +windows
+dialog_con_gui    +mksession         +signs             +writebackup
+diff              +modify_fname      +smartindent       +X11
+digraphs          +mouse             +sound             -xfontset
+dnd               +mouseshape        +spell             +xim
-ebcdic            +mouse_dec         +startuptime       -xpm
+emacs_tags        +mouse_gpm         +statusline        +xsmp_interact
+eval              -mouse_jsbterm     -sun_workshop      +xterm_clipboard
+ex_extra          +mouse_netterm     +syntax            -xterm_save
+extra_search      +mouse_sgr         +tag_binary        
   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"
       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  -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/lib/libffi-3.2.1/include -I/usr/include/harfbuzz -I/usr/include/fribidi -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/gio-unix-2.0 -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/at-spi-2.0 -pthread    -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -D_REENTRANT  -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: gcc   -L. -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.30/core_perl/CORE  -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -L/usr/local/lib -Wl,--as-needed -o vim   -lgtk-3 -lgdk-3 -lz -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0  -lSM -lICE -lXt -lX11 -lXdmcp -lSM -lICE  -lm -ltinfo -lelf -lnsl    -lcanberra  -lacl -lattr -lgpm -ldl   -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.30/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -L/usr/local/lib  -L/usr/lib/perl5/5.30/core_perl/CORE -lperl -lpthread -ldl -lm -lcrypt -lutil -lc   -L/usr/lib -ltclstub8.6 -ldl -lz -lpthread -lm 

Output of YcmDebugInfo

Printing YouCompleteMe debug information...
-- Client logfile: /tmp/ycm_wj1a_br9.log
-- Server Python interpreter: /usr/bin/python3
-- Server Python version: 3.8.2
-- 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: 1692578
--   Clangd executable: ['/usr/bin/clangd', '--log=verbose', '--sync', '-header-insertion-decorators=0', '-limit-results=500']
--   Clangd logfiles:
--     /tmp/clangd_stderrdfv4i7aw.log
--   Clangd Server State: Initialized
--   Clangd Project Directory: /home/sb/src/fpp/rap
--   Clangd Settings: {}
--   Clangd Compilation Command: False
-- Server running at: http://127.0.0.1:58369
-- Server process ID: 1692513
-- Server logfiles:
--   /tmp/ycmd_58369_stdout_q2y9vkc_.log
--   /tmp/ycmd_58369_stderr_tmtkj17f.log

Output of YcmDiags

Left out as deemed irrelevant, happy to provide if requested.

Contents of YCM, ycmd and completion engine logfiles

Left out as deemed irrelevant, happy to provide if requested.

OS version, distribution, etc.

Arch Linux

bstaletic commented 4 years ago

:help :colder and :help :cnewer (similarly :help :lolder and :help :lnewer) is what you're looking for. Vim keeps around the latest 10 locationlists and 10 quickfix lists.

puremourning commented 4 years ago

Yeah. Use the quickfix stack to get your previous entries.

Ram-Z commented 4 years ago

Oh, great. I did not know about these commands.

Thank you very much.