Earlier quoted context omitted.
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
Cquery: highly-scalable, low-latency language server for C++
11–20 of 74 posts
Re: Cquery: highly-scalable, low-latency language server for C++
#12Re: Cquery: highly-scalable, low-latency language server for C++
#13Is 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?
template
void foo(int x = 0, Args&&... args)
for example (default argument before variadic templates args).Re: Cquery: highly-scalable, low-latency language server for C++
#14Is 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…
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++
#15Earlier quoted context omitted.
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…
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 quit…
Re: Cquery: highly-scalable, low-latency language server for C++
#16Earlier quoted context omitted.
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 quit…
Rtags is great for code browsing, but completion is slow and dumb.
Re: Cquery: highly-scalable, low-latency language server for C++
#17Wow! 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…
From: https://msdn.microsoft.com/en-us/library/hh279654.aspx
"[...] Over the years, features have been added to the language, together with highly-tested standard libraries of data structures and algorithms. It's these additions that have made the modern C++ style possible. Modern C++ emphasizes:
Stack-based scope instead of heap or static global scope.
Auto type inference instead of explicit type names.
Smart pointers instead of raw pointers.
std::string and std::wstring types (see ) instead of raw char[] arrays.
Standard template library (STL) containers like vector, list, and map instead of raw arrays or custom containers. See , , and .
STL algorithms instead of manually coded ones. Exceptions, to report and handle error conditions.
Lock-free inter-thread communication using STL
std::atomic (see ) instead of other inter-thread communication mechanisms.
Inline lambda functions instead of small functions implemented separately.
Range-based for loops [...]"
Re: Cquery: highly-scalable, low-latency language server for C++
#18Wow! 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.
Re: Cquery: highly-scalable, low-latency language server for C++
#19Re: Cquery: highly-scalable, low-latency language server for C++
#20Wow! 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…
Some advice if you do decide to learn C++: there has been a steady stream of improvements in standard C++ the past 8 years (C++11-17), and some (Bjarne Stroustroup, Herb Sutter, others) promote it as a better starting point for beginners under the name 'Modern C++'. From: https://msdn.microsoft.com/en-us/library/hh279654.aspx "[...] Over the years, features have been added to the language, together with highly-tested…
Like I said, I am not turning my back on it. I have noticed that C++'s evolution has been gaining momentum over last ten years. I have even read Bjarne's book on the design and evolution of C++ - it was fascinating, and I think it is worth reading even to people who never have used C++.
The thing is that from all I have heard and read I get the impression that learning C++ - really learning it, not just C-with-classes - is a long-term commitment. That is why, as I said, I am keeping a safe distance between me and C++. ;-)
When the day comes, I will not be entirely unprepared.