vim-rtags icon indicating copy to clipboard operation
vim-rtags copied to clipboard

Diagnostics improvements + other tweaks

Open feltech opened this issue 6 years ago • 5 comments

Background

vim-rtags is the only vim plugin I could find that has the killer "rename symbol" feature for C++, as well as other great features, e.g. class hierarchy. However, diagnostics and completions were nowhere near as friendly as YouCompleteMe and ALE.

Because of the aforementioned two plugins, I already had two clang builds of my project(s) going on at any one time, and with vim-rtags that made three, which is just plain wasteful. vim-rtags was close to replacing all three with a single solution, so I set about adding some tweaks here and there. It's culminated in quite a refactor, especially for the python code (which I am much more familiar with than vimscript).

Highlights

  • Diagnostics are now shown automatically in the sign gutter, with improved rendering, and with the diagnostic message showing in the message window when the cursor is over that line. It uses simple polling to update diagnostics by default, with care taken to do as little work as possible.
  • Fixits are now supported. All fixits available for the current buffer are applied at once via <leader>rx. Errors with fixits available are marked in the sign column by Fx and suffixed in the diagnostics lists by [FIXIT].
  • Completions include more information (signature, Doxygen docs) and set the omnifunc by default. This allows for trivial compatibility with YouCompleteMe by simply disabling their built-in cpp completion.
  • Added support for --diagnostics-all via <leader>rD, to show all errors for the entire project.

Fixes

  • Remove shell=True for python 3.5+ subprocess, since shell=True means arguments are passed to the shell process, rather than RTags.
  • Use lists for commands ultimately sent to subprocess rather than spliting a string, which is better for e.g. filenames with spaces.

Tweaks

  • Sort diagnostics in the location list/quickfix list with errors at the top.
  • Added extra error messages in a few places so it's clearer if e.g. vim-rtags is having problems communicating with rc / rdm.
  • Logging is improved, including logging rdm output (if started by vim-rtags). Everything is logged to tempnames by default.

Misc

  • I've added appropriate toggles for most of the new features, i.e. g:rtagsAutoDiagnostics, g:rtagsDiagnosticsPollingInterval, g:rtagsCppOmnifunc, g:rtagsRdmLog.
  • Unit tests for the python code are included.
  • Vim documentation and README updated (a bit).
  • See the commit messages for more info. I've tried to keep them reasonable, but there is one rather large commit (70f126b) where most of the python refactor takes place, sorry about that.
  • I'm sure there's some controversial changes, and probably edge cases and other things that I've missed. I'm happy to work with you to make any changes.

feltech avatar Mar 04 '18 02:03 feltech

@feltech It appears you've put a lot of effort on this pull request -- it really looks excellent work. I'll try it and give some feedback.

konstheo avatar Aug 24 '18 21:08 konstheo

Haven't been able to test on my workstation. Vim is compiled to support only python2 and sadly most plugins I use work only with python 2 -- so recompiling for python 3 support will kinda make my system not really usable for developing. Do you have plans, @feltech , to also support python2?

konstheo avatar Sep 03 '18 20:09 konstheo

Hey, thanks for taking a look. I'll try to find some time to ensure it's python2 compatible. I've also done some follow-up work that I'm yet to PR, since it's based on this stuff, so it would be nice to get this reviewed.

feltech avatar Sep 10 '18 10:09 feltech

In fact @feltech I was mistaken thinking that your pull request isn't Python 2 compatible. After paying attention to the errors I received, I was able to make it work with a couple of tweaks in your code and it works pretty ok so far. I'll open an issue on your side of things regarding those tweaks.

konstheo avatar Mar 25 '19 15:03 konstheo

I did some testing with this (rtags 2.33) and saw some minor issues;

  • There is a rather spammy "RTags caches have been reset" status being printed all the time, to the point where other status messages are hard to catch.
  • Vim feels less responsive, especially while rdm is reindexing files.
  • While running a large reindex triggered by rc -J, vim hangs for some time on trying to query rdm (without me having done any changes to warrant a query for status)
  • When I switch from the location list to file contents, the little sidebar thing with W/E markers disappears.

Note: If it matters, I was running with this branch rebased on top of the current master.

xim avatar Sep 19 '19 09:09 xim