When I was learning C++ using JetBrains CLion IDE, I noticed there are comments in the code that looks different from Ctrl + / comments. Those comments have a pen and book gutter icon (documentation).
These only appear if I select "add onboarding tips" while creating a new project. And I can add tips by using // TIP
in the beginning of the comment. But I can't replicate this in other project where I did not select the "onboarding tips". Also, I could not replicate this in the same project with enabled "onboarding tips" in separate C++ source files. I have done some research but no luck.
Example images:
// TIP See CLion help at \<a
// href="/"\>jetbrains/help/clion/\</a\>.
// Also, you can try interactive lessons for CLion by selecting
// 'Help | Learn IDE Features' from the main menu.
When I was learning C++ using JetBrains CLion IDE, I noticed there are comments in the code that looks different from Ctrl + / comments. Those comments have a pen and book gutter icon (documentation).
These only appear if I select "add onboarding tips" while creating a new project. And I can add tips by using // TIP
in the beginning of the comment. But I can't replicate this in other project where I did not select the "onboarding tips". Also, I could not replicate this in the same project with enabled "onboarding tips" in separate C++ source files. I have done some research but no luck.
Example images:
// TIP See CLion help at \<a
// href="https://www.jetbrains/help/clion/"\>jetbrains/help/clion/\</a\>.
// Also, you can try interactive lessons for CLion by selecting
// 'Help | Learn IDE Features' from the main menu.
Share
Improve this question
asked Feb 15 at 7:51
Muhammad JUBAER HASANMuhammad JUBAER HASAN
211 silver badge3 bronze badges
1 Answer
Reset to default 1The little light bulb icons you see are a CLion feature, not a C++ feature. There's no way to put them into your source code, nor should you try to do so.
C++ source files are just plain text files. As such, there are no hidden properties or any magic functionality in them. You don't need a sophisticated IDE to write them, a simple text editor is enough.
IDEs provide functionality to make editing source code files more convenient.
The Ctrl + / is one example.
Comments in C++ are either // line comment
or /* block comment */
and you can just type it out - or use the IDE's shortcut to insert a comment.
In a similar way, CLion has a special treatment for comments starting with "TIP" if "onboarding comments" is enabled. These are rendered differently as can be seen in your screenshots.
This is a kind of tooltip intended to make CLion easier to use for new users.
Again: this is CLion, not C++.
For C++, // TIP
is just a comment and will be ignored.
You can put a hundred of these comments in your source code and not change the behavior of the resulting program.
Don't expect this to work (in different IDEs) and don't rely on it.
It won't work for your co-worker using a different editor/IDE.
As a side note, I would suggest to try a different IDE for some time to make sure you learn the language, not the tool. A change in perspective tends to give new insights.