News for hackers. Stuff that matters.
Re:Cquery: highly-scalable, low-latency language server for C++ by jchw on Friday November 17, 2017 @08:15AM (#15721690)
For one thing, it sounds like it implements the Language Server protocol, which will make it usable for other IDEs and text editors with support for this protocol (a quickly growing list.)

Not aware of Rtags but I'll assume it's similar to the omnipresent C tags but with an actual C++ parser. If that's the case, in theory cquery is a lot more powerful; it would include the symbol indexing of Rtags but also code refactoring tools ("fixits",) fully aware context-sensitive auto-complete, ability to detect dead code (i.e. #if 0 or #ifndef _WIN32) and support for the type hierarchy. Some of that stuff is definitely not supported by LSP so I imagine it's custom stuff for VSCode only.

All in all, it sounds like it would provide most of the IDE experience to VS Code. The only annoying part would be that you'll have to extract the compile flags from your build system yourself, but that's not usually too big of a deal.

Re:Cquery: highly-scalable, low-latency language server for C++ by to3m on Friday November 17, 2017 @09:22AM (#15722153)
One interesting thing that rtags does is provide a gcc/clang wrapper script. You make symlinks to it called cc/c++/gcc/g++/etc. in a folder that's in PATH ahead of wherever gcc/clang proper live. When invoked, the script submits an appropriate tags job to the rtags server, complete with compile flags actually used, then passes the command line on to the appropriate tool so that the compile actually gets done.

So quite often you won't need to do anything. (If you use CMake, you will have to rebuild your Ninja/make files after first setting this up.)

I didn't find rtags perfect. There were a few files that it simply never seemed to create tags for, and the rtags setup is complicated enough that I couldn't quickly figure out why, so I just put up with it. But when it works, it works very well...

(This sort of thing seems to be par for the course with this kind of tool. I've seen a number of people complain about how terrible Visual Studio's code browsing is, for example, but it's been a long time since I've had a problem with it...)

Re:Cquery: highly-scalable, low-latency language server for C++ by zarkov99 on Friday November 17, 2017 @09:24AM (#15722163)
Rtags is great for code browsing, but completion is slow and dumb.
Re:Cquery: highly-scalable, low-latency language server for C++ by to3m on Friday November 17, 2017 @09:33AM (#15722225)
I found it fine once I'd set it up to do completion only by request, so I'd know that I might have to wait. The default, whereby it tries to pop up as you type, was absolutely maddening...
Re:Cquery: highly-scalable, low-latency language server for C++ by sient on Friday November 17, 2017 @10:38AM (#15722792)
> All in all, it sounds like it would provide most of the IDE experience to VS Code. The only annoying part would be that you'll have to extract the compile flags from your build system yourself, but that's not usually too big of a deal.

This can be done similar to what rtags does (hooking into gcc/clang invocations). Alternatively if you use ninja this relatively simple by generating a compile_commands.json file.

    ninja -C out/Release -t compdb cxx cc > compile_commands.json
My eventual plan is to automate compile_commands.json generation if using ninja, so cquery is install and go.
Re:Cquery: highly-scalable, low-latency language server for C++ by snowAbstraction on Friday November 17, 2017 @08:47AM (#15721886)
rtags is also using libclang for parsing, fixits, etc.

Here is a demo of rtags can do with a proper emacs setup: CppCon 2015: Atila Neves "Emacs as a C++ IDE" https://youtu.be/5FQwQ0QWBTU

Re:Cquery: highly-scalable, low-latency language server for C++ by jchw on Friday November 17, 2017 @08:59AM (#15721968)
edit: Comment above has updated with more information, making this reply redundant. :)