ReSharper C++: 5 Years On

Anastasia Kazakova

When you hear the name ReSharper, you likely think about a tool for C# first. And indeed, for more than 10 years ReSharper was oriented toward .NET development, from C# to VB.NET and others. But 5 years ago, we announced ReSharper for C++, an extension to Visual Studio for C++ developers. While we can’t say that it changed the world completely, it definitely changed the way we and many other developers think about ReSharper, as well as the way C++ developers work in Visual Studio. Let’s talk to the team about the challenges they faced, the choices they made, and their vision for the future.

resharper_c++_bgr_twitter_1500x500

The team behind the tool is rather small. Well, this is not entirely true. Our .NET department has more than 100 people now, and about half of them work on ReSharper. Today, the ReSharper C++ team has 14 members, and it was even smaller when we launched the very first official version 5 years ago. But some team members were dreaming about such a tool long before it came to be.

Sergey Coox, .NET Department Lead
When I joined the company in 2004, I was a C++ programmer with 5 years of C++ experience behind me. I had been using Visual Assist, which wasn’t great but still made Visual Studio a better IDE. I was more than willing to create a ReSharper for C++ at that time, but our main efforts were put into C#. So I abandoned the idea for a while. When the team finally started ReSharper C++, I was already dedicating all of my time to .NET. That’s how this fantastic story happened without me, unfortunately 🙂

Mikhail Senkov, ReSharper C++ Team Lead
I actually remember Sergey Coox sharing his dream about a C++ IDE with me in 2004. And it was my dream, too! To create a C++ IDE that gets not only what the developer is trying to do, but also the language, the code semantics, and the program logic. Our vision was to incorporate the best practices, and the expertise and knowledge of the community leaders into a tool which could guide novices and support experts. Ten years later, JetBrains gave me a chance to make my dream come true!

Igor Akhmetov, ReSharper C++ Software Developer
We started working on ReSharper C++ eight years ago, at a time when C++ editor tooling was trailing far behind what IDEs provided for other popular languages. Our goal was to equip C++ developers with the same productivity features that C# and Java engineers enjoyed when using ReSharper and IntelliJ IDEA.

As you can see, an ambitious goal was set. The core challenge was the language itself.

Ilya Biryukov, ReSharper C++ Software Developer
Working on ReSharper C++ was my first real full-time job, I really liked the challenge from the very first days. I knew from folklore that C++ was not a tooling-friendly language, but I couldn’t imagine how far the problems went.

Igor Akhmetov, ReSharper C++ Software Developer
Of course, there’s a good reason why this [C++ IDE] hadn’t been properly done before. C++ is a very powerful and expressive language, but its unique features and the legacy accumulated over 40 years of language evolution pose a lot of engineering challenges. The preprocessor and the textual source inclusion model lead to a situation where a single change in a header file can potentially affect many other source files. Templates and their substitution model require deep understanding of the language semantics and are also quite taxing performance-wise. Moreover, being able to work inside an editor with a constantly changing codebase is another huge challenge which separates us from standalone static analysis tools.

Andrey Davydov, ReSharper C++ Software Developer
It’s really hard to create a C++ IDE that would be pleasant to use. On the one hand, it should follow the C++ standard in order to be 100% accurate and correct when dealing with C++ code. But on the other, it should guess what the user means in many unclear cases, which often cannot be resolved properly such as with unfinished or dependent code. A C++ IDE must perform analysis similar to what a compiler does, but has to do it much more quickly, reparsing the code on the fly, as you type.

The path was, and still is, challenging enough. And sometimes there were decisions that might sound controversial. Let me share one story with you.

Dogfooding has always played a central role in the development of our products at JetBrains. ReSharper is written in C#, which allows us to use it for the product development itself (the same way that IntelliJ IDEA developers use Java and Kotlin support inside IntelliJ IDEA). And we obviously wanted to dogfood ReSharper C++, which is an essential part of its older C# brother. That’s why we chose to use C++/CLI, an interop layer between native code and managed code. That helped with the C++ part of course, even though the technology is not widely spread and even caused some difficulties for the team.

Can you guess what the very first comment was about under the ReSharper C++ 1.0 announcement?

cpp_cli

C++/CLI support was obviously desired! However, with so many syntactic additions and peculiar changes to the C++ language semantics, handling C++/CLI was no easy task. So it took us a few years to get it on board. Nowadays, C++/CLI support covers many major features, like code inspections, typing assistance, formatting, code completion, and various Generate actions. Still, there are discussions inside the team about whether the choice was worth it or not.

Over these 5 years, ReSharper C++ has been growing constantly, enlarging its expertise in C++. It brought to the developers modern C++-oriented refactorings and integrations with cutting-edge technologies like Clang-Tidy and ClangFormat, and unit testing frameworks like Catch and Doctest. Finally, it came to the world of Unreal Engine development. We took a performance fight which is still ongoing.

Igor Akhmetov, ReSharper C++ Software Developer
To support all of the features we had in mind, ReSharper C++ implements an almost complete C++20 compiler frontend, one of only a few of its kind in the world. On top of this foundation, we built the features you’ve come to expect from a modern IDE – a code inspection engine, essential refactoring tools, a code formatter, a unit test runner, and many others. All of this had to be done within the constraints of a Visual Studio extension, and with the constant fight to be performant enough on huge codebases like the Unreal Engine.

Mikhail Senkov, ReSharper C++ Team Lead
We have an ongoing problem to solve – performance. I would call it the most challenging I’ve ever met in the industry. Because of the constant work on this problem, our language engine is much more complicated than a C++ compiler. There are lots of postponed and incremental calculations in our case. But we still need to push more.

Luckily, we have a great team who are passionate about making it work. In fact, multiple teams at JetBrains dedicate their efforts to supporting C++. And we all work together in order to create first-class tooling for all types of C++ projects, including Windows-specific projects, embedded development, projects in the financial sector, and games. We do believe we are in a great position to succeed!

Igor Akhmetov, ReSharper C++ Software Developer
I’m quite proud that we’ve built ReSharper C++ and achieved all of this with a very small team of brilliant people, and I’m looking forward to improving our product even further. And we do hope that ReSharper C++ has helped you write better C++ code and write it faster!Screen Shot 2020-04-07 at 19.04.18

Ilya Biryukov, ReSharper C++ Software Developer
I’m really proud of what we’ve achieved with a combination of meticulous work to implement the fully-functional C++ parser and semantics analysis engine and a set of clever IDE-specific tricks to implement incremental-yet-correct “IDE modules”. What excites me most is that there’s a long road ahead. I really hope to use our product to write in C++ on my Linux laptop someday.

Andrey Davydov, ReSharper C++ Software Developer
It seems the C++ ecosystem is still missing the IDE it deserves. But step by step, year by year, the quality of C++ tooling is improving and it is also getting faster. Someday, we’ll finally get a C++ IDE comparable to IntelliJ IDEA for Java. I hope ReSharper C++ will be it!

Would you like to share your favorite ReSharper C++ feature here in the comments? That would be one of the best compliments the team could get!

Your ReSharper C++ team
JetBrains
The Drive to Develop

Comments below can no longer be edited.

2 Responses to ReSharper C++: 5 Years On

  1. John Schroedl says:

    April 10, 2020

    Hey, I recognize that commentor 🙂

    …and can I be the first to congratulate all of you on a superb product! Thank you JetBrains for committing time, resources and effort to C++ (and C++/CLI!)

    • Anastasia Kazakova says:

      April 10, 2020

      Thank you so much! And for your patience with C++/CLI)

Subscribe

Subscribe for updates