Community
    • Login

    strings starting with ";" ignored when given in codeblock start/end string definition

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    12 Posts 2 Posters 2.9k 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.
    • waskomaW
      waskoma @PeterJones
      last edited by waskoma

      @PeterJones Thank you for your reply! :)

      yes it is a user defined language, here is a screenshot, this works:

      ![alt text]![c09934be-f413-4f69-b6ae-2de1431ef2fa-image.png]815ebfe4-ac45-4a86-9a30-70c4ff625afb-image.png (/assets/uploads/files/1684522990486-c09934be-f413-4f69-b6ae-2de1431ef2fa-image.png) (image url)

      and this doesnt work because of the “;”

      ![alt text]22dfd9d8-c3e5-42ee-8baf-1c0c822801d8-image.png (image url)

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

        @waskoma said in strings starting with “;” ignored when given in codeblock start/end string definition:

        this doesnt work because of the “;”

        Right. If you have a semicolon in the UDL Open/Close boxes, then you have to have a semicolon in your source code, otherwise it won’t match. Why would you expect the syntax highlighter to see ;blockbegin in the UDL definition and somehow match that to just blockbegin in the source code text file? It looks for the whole term from the UDL box when searching in your text, and if the whole term isn’t in your text file, it won’t highlight anything.

        My example below shows it working if both the UDL and the source code have the semicolon:

        8be20c3f-e8be-47e1-914c-a61e62d39f86-image.png

        Here’s an example that lets it match either with or without the semicolon, which is maybe what you want:

        4a29324f-7bd1-415d-8dcb-fdd48174ebe8-image.png

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

          @waskoma said in strings starting with “;” ignored when given in codeblock start/end string definition:

          compiler which uses ; for comments

          I hadn’t remembered that you said it was in comments. You can have a separate definition for comment-based folding compared to code-based folding.

          WIth example text

          ;blockbegin
          
          between comment blocks
          
          ;blockend
          
          outside
          
          blockbegin
          
          between code blocks
          
          blockend
          
          ; normal comment, no folding
          
          text
          
          1. Folding in Code 1 Style:
            • Styler = deep red foreground, pale yellow background; underline
            • Open = blockbegin
            • Close = blockend
          2. Folding in Comment Style:
            • Styler = green foreground, bold, underline
            • Open = blockbegin
            • Close = blockend
          3. Comment & Number tab > Comment line style:
            • Styler = green
            • Open = ;

          9e4ccac0-f9b5-43a0-92a4-a7d8495ff654-image.png

          waskomaW 1 Reply Last reply Reply Quote 1
          • waskomaW
            waskoma @PeterJones
            last edited by

            @PeterJones Thank you Peter for your help !

            previously I have made a mistake with the screenshot, just to show you it really doesnt work:

            9da9adc8-53dd-4377-b480-3f3db56dcdf0-image.png

            Secondly, I have realised what is the problem: Notepad++ decided to ignore “;” for codeblock string because I have defined it as comment. But that is just stupid, “;” is comment for the compiler and NOT for Notepad++ :D :(

            anyway now if I can live without styling my comments, I can FINALLY use codeblocks again, which makes me extremely happy, as when coding, often a huge chunk of time goes by navigating the code, with folding this is a non issue.

            Thanks again! :)

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

              @waskoma said in strings starting with “;” ignored when given in codeblock start/end string definition:

              But that is just stupid, “;” is comment for the compiler and NOT for Notepad++ :D

              As my followon post suggested, I think that what you really want is “folding in comment”, not “folding in code 1”. That would allow you to syntax-highlight a normal comment and allow the blockbegin/blockend inside your comment to cause folding… the best of both worlds.

              waskomaW 2 Replies Last reply Reply Quote 0
              • waskomaW
                waskoma @PeterJones
                last edited by

                @PeterJones oh sorry, now I understand. can you send me a screenshot on how you achieved that:? I am unable to replicate it

                1 Reply Last reply Reply Quote 0
                • waskomaW
                  waskoma @PeterJones
                  last edited by

                  @PeterJones ok sorry, and thank you for your patience, you have explained exactly what to do, and I’ve failed to understand, I’ve got the flu and my brain doesnt operate normally :D

                  so I have managed to achieve it and am REALLY happy. Gave up solving this a long long time ago (have already asked here and got answer it can not be done)

                  not related to this topic but can I ask more? I have hexadecimal numbers with prefixes $ or #$ and these numbers have abcdef letters in them, they are not recognised as numbers the moment it finds a non numeric character, is there a way to solve that ?

                  also what causes these orange vertical lines show up ? and how to style the codeblock opener closer + and line ? a million thanks :)

                  5118bad0-cb02-4e83-b89d-7adb7ca1d9c9-image.png

                  waskomaW PeterJonesP 2 Replies Last reply Reply Quote 0
                  • waskomaW
                    waskoma @waskoma
                    last edited by

                    found the turn off display change history (orange vertical bars) :)

                    1 Reply Last reply Reply Quote 1
                    • PeterJonesP
                      PeterJones @waskoma
                      last edited by PeterJones

                      @waskoma said in strings starting with “;” ignored when given in codeblock start/end string definition:

                      so I have managed to achieve it and am REALLY happy. Gave up solving this a long long time ago (have already asked here and got answer it can not be done)

                      in 2016, it looks like you both forgot to come back and follow up on the conversation, so it was never resolved; that’s not quite the same as being told it cannot be done. Under this username, you have no other posts.

                      not related to this topic but can I ask more? I have hexadecimal numbers with prefixes $ or #$ and these numbers have abcdef letters in them, they are not recognised as numbers the moment it finds a non numeric character, is there a way to solve that ?

                      Prefix 2 is where you put the prefix you want before hex numbers – in your case, $ #$ will allow either $ or #$ as the prefix. Extras 1 is where you put the extra characters that can be a part of a hex number – in your case A B C D E F a b c d e f (the comparison in UDL for that is case sensitive, so if you want it to match upper and lower case for hex digits, you have to include both upper and lower case)

                      c31e41d9-04a9-44fe-a47b-fb7001fc4c50-image.png

                      BTW: That’s in the UDL docs at https://ivan-radic.github.io/udl-documentation/ – which are linked from the UDL dialog – specifically, on the Numbers page. They give the example of how to make 0xABC work, and from there, you really should have been able to generalize that to make $ABC or #$ABC work.

                      also what causes these orange vertical lines show up ? and how to style the codeblock opener closer + and line ? a million thanks :)

                      As you discovered, that’s the new Change History feature (v8.4.6), as described in our FAQ.

                      PeterJonesP 1 Reply Last reply Reply Quote 2
                      • PeterJonesP PeterJones referenced this topic on
                      • PeterJonesP
                        PeterJones @PeterJones
                        last edited by PeterJones

                        @waskoma said in Cant change cursor color, and latest version shortcut to start batch file claims it cant find it:

                        while we’re at it, some years ago probably it was you helping me to get code folding working I want to use:

                        ;blockbegin
                        ;blockend

                        but that doesnt work again, looking at it at 8.9.2 it seems to recognize it only when there are like above right in the next row to eachother.

                        allow folding of comments is checked. comment line is set to “,”

                        line comment position is allow preceding white space

                        I am quoting and replying to this here, because this is where it belongs:

                        It still works for me in v8.9.2, using the same color descriptions as I used three years ago:

                        1ad97c38-63dc-49e1-8e73-4cd67f843f79-image.png

                        60c23da2-7e57-428c-a3dc-bdcbb8861f3f-image.png

                        If you think you have text that doesn’t work with that, click the </> button in the forum, and paste that text between the ``` lines


                        update: note that 8.9.2 actually has some bugs with regards to entering keywords: it would crash on long keywords. And, if my experiences just now were any indication, it also doesn’t necessarily save the edits to other fields, like the open/close for the folding or comment-line fields. But when I tried the bugfix build for my #17520 issue report, it allowed me to enter those other fields, and save them. So if you’re editing UDL, I actually recommend v8.9.1, not v8.9.2 (until the v8.9.3 is released with a fix)

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