CLion 2021.1 EAP: Postfix Completion for C and C++
A new CLion 2021.1 EAP build (211.6085.16) is now available from our website, via the Toolbox App, or as a snap package (if you are using Ubuntu). Note that if you are on macOS, there is a separate build for Apple Silicon (M1 chip).
Today we are delighted to introduce postfix completion for C++ in CLion! Read on for more details.
Postfix completion for C++
Postfix code completion lets you add code around an expression you’ve just typed. It can wrap an expression with a frequently used language construct, or pass the expression as the first argument of a free function.
Postfix templates to wrap expressions with language constructs
Postfix templates can help you with typical language constructs. Here’s how you can use them:
- Type an expression and then a dot.
- After the dot, type the template abbreviation (postfix).
- Press the expansion key (it’s Tab by default, but can be reconfigured in Settings/Preferences | Editor | General | Postfix Completion). Alternatively, simply select the abbreviation you need from the completion list that appears at step 2.
- The template expands and wraps your expression.
This is really useful especially when it comes to wrapping with a C++-style cast,
make_unique, various loops,
end idioms, and more:
The CLion 2021.1 EAP3 build ships with 20+ predefined templates, but unfortunately, you cannot define your own templates – for now. To find the list of abbreviations and the explanations of what the templates expand into, please go to Settings/Preferences | Editor | General | Postfix Completion. You can also enable or disable any templates from this list:
Postfix completion to pass the expression as the first argument of a free function
In this scenario, you can use postfix code completion to pass the expression you’ve just typed as the first argument to a free function. Here’s how you can use it:
- Type an expression and then type a dot.
- CLion will suggest free functions that would accept the expression as the first parameter (taking ADL into account).
- After you select a function, the code is updated so that the expression is passed as the first argument.
Do you think this postfix code completion can speed up your coding? What other postfix templates would you like to see in CLion? Let us know in the comments below!
Known issues are linked to this ticket CPP-4039. Feel free to submit a new report if you find any other problems.
This isn’t the first build in our current EAP. Here is a short summary of the enhancements that have already been introduced in earlier 2021.1 EAP builds:
- Global Data Flow Analysis
- Google Sanitizers, Valgrind Memcheck, Code Coverage in remote mode
- Clazy analyzer in CLion
- Improvements to Makefile and CMake projects
This may also be a good time to mention Code With Me – our new service for remote collaborative development, which has recently added support for voice and video calls and is now in Beta. Learn more about Code With Me.
The full release notes are available here.
Your CLion team
The Drive to Develop
Subscribe to Blog updates
Thanks, we've got you!
CLion 2023.2.2 Bug-Fix Update
The CLion bug-fix update 2023.2.2 is now available! The fixes included in this bug-fix update are listed below. Download build 232.9921.42 from our website, through the Toolbox App, as a snap package for Ubuntu, or via a patch from inside the IDE. DOWNLOAD CLION This update’s main highlights includ…
CLion 2023.2.1 Bug-Fix Update
The CLion bug-fix update 2023.2.1 is now available! If you haven’t yet upgraded to v2023.2, now is definitely a good time to do so! The key enhancements in the major 2023.2 update include: The Beta version of AI Assistant is now available as a plugin with limited access. Streamlined integratio…
What Would Make CLion a Better C and C++ IDE? The CLion 2023.3 Roadmap
It’s now time to move forward and start preparing for the next major release. We’d like to share our plans, as well as the ideas and areas we’ll be working on over the next few months.