Community
    • Login

    user defined languaje dialog, multiline comments

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 312 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • carlos CharlyC
      carlos Charly
      last edited by

      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.

      thanks

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @carlos Charly
        last edited by PeterJones

        @carlos-Charly ,

        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 ^X says “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 Z says “Z will end the multiline comment”

        This shows that regex in action:
        36ba5347-ecf6-4e9c-8df8-488c7e48ed7e-image.png
        The first starts with X, so it will make it light green comment until the next Z, even across multiple lines. The second X is not at the beginning of the line, so it doesn’t start a multi-line comment.

        carlos CharlyC 1 Reply Last reply Reply Quote 5
        • carlos CharlyC
          carlos Charly @PeterJones
          last edited by

          @PeterJones Thank you! Using EnhanceAnyLexer plugin In 10 minutes I colored my special multiline comments! Good solution!

          1 Reply Last reply Reply Quote 3
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors