lyuts / vim-rtags

Vim bindings for rtags, llvm/clang based c++ code indexer.
BSD 2-Clause "Simplified" License
282 stars 56 forks source link

Getting compile errors/warnings for a cpp file #44

Open dan-t opened 8 years ago

dan-t commented 8 years ago

Hi lyuts,

thanks for the nice vim plugin!

The emacs plugin for rtags supports flycheck, which seems to be running rc --diagnostics, so can there be something similar on the vim side?

In the doc of --diagnostics something about async formatting is mentioned, which might be the problem on the vim side.

Greetings, Daniel

lyuts commented 8 years ago

I would need to do some investigation in order to determine if this is doable for vim. Thanks for bringing this to my attention.

dan-t commented 8 years ago

On Sun, Jun 26, 2016 at 05:54:49PM -0700, lyuts wrote:

I would need to some some investigating in order to determine if this is doable for vim. Thanks for bringing this to my attention.

Oh, it's not --diagnostics but --diagnose.

dan-t commented 8 years ago

Sorry for the confusion, it's '--diagnostics' :/.

Reading the doc again:

(rtags-diagnostics)

Start an async process in a buffer to receive warnings/errors from clang whenever a file gets reindexed. It integrates with flymake to put highlighting on code with warnings and errors

Which most likely will be a bit hard to integrate into vim.

dan-t commented 8 years ago

I asked the developer of 'rtags' and currently there's no synchronous version of '--diagnostics' which is callable for one specific file, but he might have a look about it.

dpelle commented 7 years ago

I asked the developer of 'rtags' and currently there's no synchronous version of '--diagnostics' which is callable for one specific file, but he might have a look about it.

For it to be usable, it has to be asynchronous anyway, as it would be annoying for Vim to block for several seconds while compiling the file. Latest Vim from github (which will soon be vim-8.0) has support for asynchronous plugins, see :help channel. It would be great to highlight syntax errors and warnings via rtags while editing in Vim, in a asynchronous way.

dan-t commented 7 years ago

For it to be usable, it has to be asynchronous anyway, as it would be annoying for Vim to block for several seconds while compiling the file.

It highly depends on your workflow. If you want on the fly checking as you type, then a synchronous solution isn't an option. But if you just want to check if you're writing the file, then the synchronous solution is more than enough, and also the asynchronous solution wouldn't be really faster in this use case.

dpelle commented 7 years ago

It highly depends on your workflow. If you want on the fly checking as you type, then a synchronous solution isn't an option. But if you just want to check if you're writing the file, then the synchronous solution is more than enough, and also the asynchronous solution wouldn't be really faster in this use case.

OK, that can be true. Although still, compiling a single c++ file can take several seconds and waiting for several seconds when saving can be annoying. Asynchronous will not be faster, but would feel faster as it does not block. In any case, if we want to highlight errors while typing (without explicitly saving) then asynchronous is a must I think.

marxin commented 7 years ago

I guess this can be closed.

marxin commented 6 years ago

Can you @lyuts please close it?