[Gambas-user] Making code pretty

Kevin Fishburne kevinfishburne at ...1887...
Fri Aug 5 18:34:16 CEST 2011


On 08/05/2011 12:02 PM, Ron wrote:
> It's not only eye candy, it's also a practical thing.
> If you have a bigger public project under svn, you don't want that the
> removal of one isolated space character on a empty line somewhere generates
> a commit change.
>
> So I  remove them all in my projects while writing code.
>
> Regards,
> Ron_2nd.
>
> 'Pretty' is in the eye of the beholder. I write my code so it is easy to
> read and easy see the structure of the code, spaces and empty lines are
> therefore used extensively. Since the compiled code is not affected by them
> what's the problem?

Ideally there would be a menu rather than a one-size-fits-all command 
(as there currently is). These options could be checked or unchecked as 
the user sees fit.

I'm a formatting Nazi. A space at the end of a line, or on an "empty" 
line, or anything that doesn't fit a rigid set of formatting standards, 
drives me crazy to no end. While I too carefully format my code as I 
write it, to give you an example of this feature's usefulness, I 
recently updated 20 OpenGL gb2 projects (which I didn't write) to gb3. I 
practically set my keyboard on fire and gave myself carpal tunnel 
syndrome just deleting spaces and removing unnecessary empty lines. All 
I can say is thank God the projects weren't longer.

Also, just to clear things up, no one's suggesting deleting empty lines 
or spaces used in indentation. Just trailing spaces and spaces on empty 
lines, which no one in their right mind would purposely put in their 
code as they serve no purpose. An option to remove consecutive empty 
lines would be nice though (three breaks/CR's would become two).

Someone earlier mentioned that hitting Enter in the middle of a comment 
line should automatically insert a comment character at the beginning of 
the line being brought down. I just had that happen to me last night 
(normally I don't split comments across multiple lines), and it sounds 
like a good idea. He was right that having to go through the comment and 
correct the case and spacing was a PITA. Here's an example:

   ' Camera is always exactly in the middle of the render window, so the 
upper-left corner of the center tile (not yet offset)

   ' Camera is always exactly in the middle of the render window,
   so the Upper - Left corner Of the center tile(Not yet offset)

-- 
Kevin Fishburne
Eight Virtues
www: http://sales.eightvirtues.com
e-mail: sales at ...1887...
phone: (770) 853-6271





More information about the User mailing list