Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 Add Include a bit smarter
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Adequat
Tomato Guru

167 Posts

Posted - Jun 13 2018 :  06:45:39 AM  Show Profile  Reply with Quote
"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.

feline
Whole Tomato Software

United Kingdom
17012 Posts

Posted - Jun 14 2018 :  05:56:51 AM  Show Profile  Reply with Quote
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?

zen is the art of being at one with the two'ness
Go to Top of Page

Adequat
Tomato Guru

167 Posts

Posted - Jun 14 2018 :  09:02:37 AM  Show Profile  Reply with Quote
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 :)
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
17012 Posts

Posted - Jun 15 2018 :  07:38:19 AM  Show Profile  Reply with Quote
That's fair, I have put in a feature request for this:

case=117094

zen is the art of being at one with the two'ness
Go to Top of Page

sean
Whole Tomato Software

USA
2817 Posts

Posted - Sep 24 2018 :  2:29:12 PM  Show Profile  Reply with Quote
case=117094 is implemented in build 2291.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2019 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000