Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Add Include a bit smarter

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
Adequat Posted - Jun 13 2018 : 06:45:39 AM
"Add Include" is a great feature that I use a lot. When there is an existing
#include "stuff.h"
then "Add Include" insert the statement at a good place. So far so good.

But if there is none, then the #include statement is inserted at the very top of the file... but in my case, in I guess in the case of many, the top of the file starts with a header, for example:

/* -----------------------------------------------------------------------------

	Project     : ...
	Created by  : ...
	Description :

----------------------------------------------------------------------------- */


"Add Include" inserts the #include before that comment. And this is not good.
Hence my suggestion:

Insert the #include after the first comment block of the file, if that comment block starts at the very top of the file.
4   L A T E S T    R E P L I E S    (Newest First)
sean Posted - Sep 24 2018 : 2:29:12 PM
case=117094 is implemented in build 2291.
feline Posted - Jun 15 2018 : 07:38:19 AM
That's fair, I have put in a feature request for this:

case=117094
Adequat Posted - Jun 14 2018 : 09:02:37 AM
90% of the time I use "Add Include" in .cpp files. But your remark about #pragma once is good to take into account, too.

quote:
Would being strict about the comment at the very top of the file be good enough?


I guess that anything that is blank or comment, should be skipped. And skip #pragma once too, and you have the perfect solution :)
feline Posted - Jun 14 2018 : 05:56:51 AM
This makes a lot of sense. I just want to double check a couple of possible edge cases first though.

Do you run into this in header files, or do you only ever use Add Include in .cpp files? I am thinking about the #pragma once line that a lot of header files start with.

Also, due to a very old habit due to an old Vi bug under Unix, I tend to always start my files with a blank line. So the header comment block tends to start one line down in the file. Would being strict about the comment at the very top of the file be good enough?

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000