Live data from Hacker News

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

github.com

21–30 of 74 posts

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

#22

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

I tried using rtags before developing cquery, but found it did not perform well enough for Chrome when doing a huge number of semantic operations (I was hacking in support for code lens). I spent some time trying to figure out if it code be fixed but I believe it would have been too large of an architectural change.

- cquery interacts with an editor via the language server protocol, letting it work with any editor with relatively minimal work - cquery handles larger repositories better (ie, indexing all of Chrome takes 20-30 minutes on a high-end workstation) - cquery responds to semantic requests within 10ms or so

There are some other differences but those are related to the features implemented, ie, cquery supports code lens.

I'm not sure how code completion is in rtags, but I've spent a fair amount of time making it work as fast as possible in cquery. There is quite a bit of caching built on-top of the clang API which often makes it feel instantaneous.

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

#23
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…

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

#24
post #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 o…

Although C++ has lots of warts, I still really like the language mainly thanks to the tooling around it. It has had very good IDEs for years and when I see some of the advancements in debuggers and profilers for more modern languages I feel that they are still quite behind.

Note that this server is based on libclang. This is good because having a good language support means that you have to practically write a compiler for it, using an actual compiler is the best way.

However, it is true that I have always used a full fledged IDE – mostly Qt Creator. I never had courage to configure Vim for it and now I will not invest in that. But if a good and fast language server for it existed a few years back I would definitely jump on it.

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

#26
post #18
post #12

Wow! I've just tested this and it's awesome. Much better than the C/C++ extension, since it's more robust (no false-positives for go-to-definition), faster and has more features (e.g. refactoring, better auto-complete, ...). It basically turns VS Code into the best C++ IDE possible for me.

It's not really linked to VSCode, is it ? i was under the impression that by example Sublime integration for LSP was possible.

Yep, the idea is that the same protocol can work with any editor: https://langserver.org

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

#27
post #25

Run away from Jonathan Blow, as of today he was full rant mode on language server and similar stuff including on people that think this is a acceptable stuff, notably Hacker News audience. FYI, I 150% disagree with his useless rants.

I saw that on Twitter but I couldn't figure out what his actual complaint was. I think I'd probably disagree but I'm still interested in knowing.

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

#28
post #25

Run away from Jonathan Blow, as of today he was full rant mode on language server and similar stuff including on people that think this is a acceptable stuff, notably Hacker News audience. FYI, I 150% disagree with his useless rants.

I saw that on Twitter but I couldn't figure out what his actual complaint was. I think I'd probably disagree but I'm still interested in knowing.

That doing all of this stuff via rpcs vs function calls is crazy I believe.

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

#30
post #28

Earlier quoted context omitted.

I saw that on Twitter but I couldn't figure out what his actual complaint was. I think I'd probably disagree but I'm still interested in knowing.

That doing all of this stuff via rpcs vs function calls is crazy I believe.

He's not totally wrong, but casting it as a 100% clear-cut decision -- with the RPC version as the obviously bad, "highly damaging" choice -- is just wilfully stupid and dishonest. It's clearly a tradeoff.
Post reply on HN