Add #include statement

Given a selected identifier in the code editor, I wish there would be a command to tell R++ to insert the corresponding #include statement at the top of the source file. I am surprised not to find this basic command inside the otherwise very complete command set of R++.
Am I overlooking something?

I know that R++ will propose to insert that statement with a small popup when the symbol is not declared in the scope file. But I wish for an explicit command for this.

5 comments
Comment actions Permalink

You should normally get the same suggestion to add the necessary #include statement as a quick-fix in the Alt+Enter menu.

0
Comment actions Permalink

No if the #include is already indirectly included (even from a precompiled header), R++ does not provide this option. My request is precisely about this. Visual Assist allows this (I wish to get rid of Visual Assist, hence I am looking for the missing parts I need, in R++).

0
Comment actions Permalink

Do you mean this action - https://docs.wholetomato.com/default.asp?W177? The documentation says it's "for headers that resolve unknown symbols in the current C++ source file", or does it work for any symbol?

0
Comment actions Permalink

Do you mean this action

Yes

The documentation says it's "for headers that resolve unknown symbols in the current C++ source file", or does it work for any symbol?

it works for any symbol. If the related #include is already present, nothing is done, which is normal. But if the symbol is not defined or defined through an indirect include, then #include that defines precisely the symbol is inserted in the source file.

 

0
Comment actions Permalink

I see, I guess it should be possible to add a context action that adds a direct include directive. Filed https://youtrack.jetbrains.com/issue/RSCPP-33525.

1

Please sign in to leave a comment.