user defined languaje dialog, multiline comments
Hi, I can`t configure a custom language succesfully. I want configure multiline comments with the property “force at beginning of line”. It’s possible to add this improvement to next version of notepad++?
Example: my custom code has comments that start with character X at beginning of a line, and end with character Z in any position at another line.
That’s not the way that UDL is currently implemented.
You are free to submit a feature request issue (we fellow users in the Community cannot make codebase changes for you; you can see our FAQ for how to make official feature requests), but UDL hasn’t had any feature requests implemented in years, so don’t expect it by the next Notepad++ release (or, sadly, likely ever). The developer’s mindset seems to be that “it’s good enough”.
For anything more complex than Notepad++ UDL can handle right now, the developer seems to expect you to write a custom lexer plugin for your language, which has the full power of your coding skills to apply whatever syntax highlighting rules you would like to implement.
Do you really need it to “only at the beginning of the line”? Because if character X is never used for anything else in your language, it could still be the multi-line comment start-character.
If it does need to be “only at the beginning of the line”, you could use the plugin EnhanceAnyLexer to add a regex for your current language. Then use Plugins > EnhanceAnyLexer > Enhance Current Language to add It would look something like
[YourUdlNameHere] 0x00CC00 = (?s)^X.*?Z
The regex starts with
(?s), which says to allow it to match across multiple lines, the
^Xsays “first comment line must start with X, no preceding text or whitespace”.
.*?says “match everything (even newlines) until first occurrence of next part of regex”, and
Zsays “Z will end the multiline comment”
This shows that regex in action:
The first starts with
X, so it will make it light green comment until the next Z, even across multiple lines. The second
Xis not at the beginning of the line, so it doesn’t start a multi-line comment.
@PeterJones Thank you! Using EnhanceAnyLexer plugin In 10 minutes I colored my special multiline comments! Good solution!