comment symbol @ empty lines
-
Hello, I defined a language using own comment symbols. When I select bigger part of the document, empty lines don’t receive a comment symbol. Is there any workaround? Any help is welcome.
-
-
@om_mani_pad
I’m sorry, but I don’t understand how the screenshot relates to the post you made. I don’t see an
@
symbol defined.
Also, are you sure it makes sense to define$
as an identifier for a comment line and a block comment? -
@Ekopalypse the text document will be read by an FE-Solver. The Keywords contain several lines, including also empty lines which gives default values to solver. Modifications results in commenting several keywords. it is neccessary to comment empty lines. Usually $ starts a comment, in the above example the $ should appear also in line 2 for example. Is there any automatic option to comment many lines with and without characters?
-
There are two problems with your UDL Comment definitions:
Problem number 1: Your Block Comment (Blockkommentare) definition is invalid, since there is no Close indicator (Kommentarende), and blocks continue to the end-of-file if there is no matching close-indicator
Problem number 2: Your Comment Line (Zeilenkommentare) definition conflicts with your Block Comment, since both have the same Open indicator (Kommentaranfang). Comment Lines don’t need Close indicators (though they are obviously allowed), because they will automatically close at the end of the line if there isn’t a Close defined.
In your situation, problem number 2 cancels problem number 1, because Comment Line takes precedence over Comment Block, so your comments are being treated as Comment Line, and thus automatically end at the end of each line. But if you give a different Style through the Styler button (Stil …) on the two different comment types, you will see that it’s being interpreted as a Comment Line, not a Block Comment.
Is there any automatic option to comment many lines with and without characters?
For a built-in language’s lexer, if you use Edit > Comment/Uncomment, you can apply or remove single-line-comment or comment-block indicators to your selection. However, that’s for the built-in languages; UDLs are separate, and those menu actions do not read the comment characters from the active UDL definition, unfortunately. I forget whether there’s an alternate way to do the equivalent for UDLs… I might do some experiments, and report back later, if no one else beats me to it.
But the easy way is to use Column Selection Mode (click at the top-left, then either Alt+DragMouseCursor or Alt+ArrowKeys to select a rectangle): If you column select a N-row x 0-column rectangle at the beginning of the lines you want to comment, you could do that selection and then type dollarsign-space (
$
) and it will comment all those.similarly, Column Select the dollarsign-space on all those lines and type BACKSPACE or DEL and it will uncomment them.
-
@PeterJones Thank you!