Please ignore comments for indentation

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Thunder93
Addict
Addict
Posts: 1788
Joined: Tue Mar 21, 2006 12:31 am
Location: Canada

Re: Please ignore comments for indentation

Post by Thunder93 »

I have no problem with the block comments with the semicolon at the very beginning of the line. However, it's not constant positioning. Removing the commented line or lines don't bring back the original positioning / format. Moving, relocation of these lines also gets messy.

I think this block comments stuff should be consistent regardless, and currently it's not.
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Re: Please ignore comments for indentation

Post by blueznl »

I actually like the current way comments are implemented, so I vote for no change! Oh. Can't vote... oh well.

If you're desperately in need of block comments, I'd suggest one of two options:

1. StartComment and EndComment and everything in between is ignored... (A bit how my wife sees me, as I seem to be living within a StartComment / EndComment structure, alas 8) )

or

2. The double semi colon, aka ';;'

Code: Select all

for a = 1 to 10
  for n = 1 to 10
    ;
    ; regular comment
    ;
;;
;; unadjusted comment
;;
    ;
  next n
next a
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Re: Please ignore comments for indentation

Post by freak »

netmaestro wrote:Here's a start:

Code: Select all

If prefs->comment_alignment is true
  If this line contains a semicolon
    If the line above this line contains a semicolon
      Move the comment portion of this line only such that the semicolons are aligned
    EndIf
  EndIf
EndIf
FYI: I just implemented this way for the next release (minus the prefs option). Your original example now aligns nicely even after a reformat. It works quite well and is not really in the way imho, so I don't think there is need for a configuration option.

A second feature that comes with it is the ability to align/shift the comments of a selected code block with Ctrl+Left and Ctrl+Right :wink:
quidquid Latine dictum sit altum videtur
User avatar
Thunder93
Addict
Addict
Posts: 1788
Joined: Tue Mar 21, 2006 12:31 am
Location: Canada

Re: Please ignore comments for indentation

Post by Thunder93 »

Looking forward. :D
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
Little John
Addict
Addict
Posts: 4777
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Please ignore comments for indentation

Post by Little John »

freak wrote:FYI: I just implemented this way for the next release (minus the prefs option). Your original example now aligns nicely even after a reformat. It works quite well and is not really in the way imho, so I don't think there is need for a configuration option.
You did it without an additional prefs option, and without an additional special character. That sounds good. :)
Thanks!
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: Please ignore comments for indentation

Post by davido »

@freak,

Thank you, very much. :D
DE AA EB
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: Please ignore comments for indentation

Post by netmaestro »

Thanks, sounds perfect! :D
BERESHEIT
Post Reply