Live data from Hacker News

Cquery: highly-scalable, low-latency language server for C++

github.com

1–10 of 74 posts

Re: Cquery: highly-scalable, low-latency language server for C++

#4

Is this like https://github.com/Andersbakken/rtags but for vscode? Any key differences?

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++

#6
Wow!

I consider myself lucky that I practically do not have to deal with C++, but if I were a C++ kind of person, right now I would deeply appreciate how much hard work goes into a tool like this. [1]

In order to be any good, it has to be even more clever than the compiler, at least in a few ways.

And I have a hunch that in the field of programming languages that are used these days, C++ is probably not the easiest one to write such an analyzer for. ;-)

TL;DR - Respect! I can only - but vividly - imagine how hard it must be to create a tool like this.

[1] I have mixed feelings regarding C++, because I have only used it in tiny doses. I treat the language the same way I would treat a bear, if one suddenly appeared: Keep my distance, avoid any sudden motions, but also, under no circumstances, dare I turn my back on it because of the slight chance that it might come after me eventually. I do not actively dislike C++, I just have not found the time to learn it, and I get the impression that if I really want to learn it, it will take much more time than I can currently afford to invest. Maybe some day it will come to pass (that will be a good day also to finally read Moby Dick all the way through from end to end.)

Re: Cquery: highly-scalable, low-latency language server for C++

#7
post #4

Is this like https://github.com/Andersbakken/rtags but for vscode? Any key differences?

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 refac…

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++

#8
post #5

Is there one similar to this but that doesn't require your code to compile under Clang? I have plenty of projects at home that don't instantly work under Clang. So far, I've never seen any C++ language server that doesn't rely on Clang unfortunately.

Unlikely because GCC deliberately made it hard to reach into its internals for a long time. The only other implementation is the one by Microsoft based (presumably) on their C++ compiler.

Re: Cquery: highly-scalable, low-latency language server for C++

#9
post #5

Is there one similar to this but that doesn't require your code to compile under Clang? I have plenty of projects at home that don't instantly work under Clang. So far, I've never seen any C++ language server that doesn't rely on Clang unfortunately.

What are the usual culprits that prevent it from working under clang?
Post reply on HN