Page 1 of 1

Comment

Posted: Tue Apr 15, 2025 7:16 am
by rndrei
How to make a large piece of code comment?

Re: Comment

Posted: Tue Apr 15, 2025 8:22 am
by BarryG
Select it and press Ctrl+B. To uncomment, select it and press Shift+Ctrl+B.

Or, wrap it with "CompilerIf 0" and "CompilerEndIf" like this:

Code: Select all

CompilerIf 0
  a$="Hello"+#CRLF$
  a$+"there"
  MessageRequester("This block is ignored",a$)
CompilerEndIf

Re: Comment

Posted: Tue Apr 15, 2025 8:44 am
by Marc56us
...and to make it foldable, prefix and suffix the first and last lines with ;{ and ;}

Code: Select all

;{ Here a big comment (Unfold to read in full)
; bla
; bla
; bla
;}

Re: Comment

Posted: Tue Apr 15, 2025 2:41 pm
by AZJIO
BarryG wrote: Tue Apr 15, 2025 8:22 am

Code: Select all

CompilerIf 0
  a$="Hello"+#crlf
  a$+"there"
  MessageRequester("This block is ignored",a$)
CompilerEndIf
This is a great imitation when you want to disable part of the code, but at the same time it remains readable. I think it would be possible to add special tags CommStart - CommEnd or ;cs ;ce
Marc56us wrote: Tue Apr 15, 2025 8:44 am

Code: Select all

;{ Here a big comment (Unfold to read in full)
; bla
; bla
; bla
;}
This method has problems: if you perform "Code Formatting", the indentation disappears and the code becomes almost unreadable.

Re: Comment

Posted: Wed Apr 16, 2025 12:22 pm
by Marc56us
AZJIO wrote: Tue Apr 15, 2025 2:41 pm
Marc56us wrote: Tue Apr 15, 2025 8:44 am

Code: Select all

;{ Here a big comment (Unfold to read in full)
; bla
; bla
; bla
;}
This method has problems: if you perform "Code Formatting", the indentation disappears and the code becomes almost unreadable.
Hi,

By "Code Formatting", you mean Ctrl + i ?
If Yes, I never have problem, indentation remain OK
(Windows version)

Re: Comment

Posted: Wed Apr 16, 2025 12:49 pm
by AZJIO
Marc56us wrote: Wed Apr 16, 2025 12:22 pm If Yes, I never have problem, indentation remain OK
This is only my problem, since I use my tool to correct indentation

Re: Comment

Posted: Wed Apr 16, 2025 1:56 pm
by Quin
The only time I've seen the auto-indent in the IDE seriously screw up indentation of comments is if you have a comment after something like a global variable, then another comment on the line under it. It will try to align your comment with the first one :twisted: