Wish Block comment

Troberg

Well-Known Member
Licensed User
It would be very nice to have a way to comment out an entire block with simply a start and end marker, both for commenting out code and to avoid having to prefix every line with a ' in comment headers.

Example:

B4X:
<<
This is all comments
This is also a comment
Even more comments
>>
It would also be nice if the entire line was treated as a comment for block comments. I use Another background color for comments, and it's nice if the comment headers don't look like a bar graph.
 

ac9ts

Active Member
Licensed User
There is a block comment icon in the IDE. It is between the search binoculars and the navigate arrows. Highlight the block and press the comment icon. This will also comment your comments so when you un-comment the section, the original comments will be intact. Ignore this if you already knew of this feature.
 

Troberg

Well-Known Member
Licensed User
I know about that, but it simply makes each line a line comment.

Which is neater, this:

B4X:
' CurrentVersion: 1.0
' Maintainer: Troberg

'Todo
'If no valid bearing, get from device compass instead

'Future
'...

'Done
'1.0
'First version
or this:

B4X:
<<
CurrentVersion: 1.0
Maintainer: Troberg

Todo
If no valid bearing, get from device compass instead

Future
...

Done
1.0
First version
>>
Now, imagine the comments above with a colored background. It looks like a bar graph. Imagine instead that the block comment lines had a background that extended the entire page width. I would have a nice, square, differently colored background comment header.
 

ac9ts

Active Member
Licensed User
I see your point but if using the default colors (as shown above), it's hard to see where the comments are vs. the code if the commented code stays the same color as un-commented code. This could be really confusing if you had multiple screens worth of commented code. Of course, it all depends on the color scheme as you mentioned as well as personal preference. My colors are below and (for me) it's easier to see the commented section. I don't like the bar graph look either so that is why my color scheme is what it is.

N1.jpg
N2.jpg
 

Troberg

Well-Known Member
Licensed User
I see your point but if using the default colors (as shown above), it's hard to see where the comments are vs. the code if the commented code stays the same color as un-commented code. This could be really confusing if you had multiple screens worth of commented code.
I didn't make myself clear. Comments should still look like comments, just that the comment style should fill the entire line.
 
Top