• Login
Community
  • Login

UDL: Suffix Mode

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
54 Posts 8 Posters 19.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.
  • E
    Eko palypse
    last edited by Feb 14, 2019, 4:08 PM

    Do the following

    • copy the script

    • goto Plugins->Python Script->New Script

    • give it a meaningful name and press save button

    • paste the script into the newly ceated document

    • save it

    • open one of your BR! Source files

    • click on Plugins->Python Script->Scripts->NAME_OF_THE_NEWLY_CREATED_PYTHONSCRIPT

    If you want to know the details, let me know.

    1 Reply Last reply Reply Quote 1
    • E
      Eko palypse
      last edited by Feb 14, 2019, 4:16 PM

      btw, when it works like you want and want it to be available automatically
      on every npp startup we need to create a USER startup.py but
      I guess this can be discussed it the script is useful to you at all

      1 Reply Last reply Reply Quote 0
      • M
        Michael Miller31
        last edited by Feb 14, 2019, 5:04 PM

        Thanks for putting the time into this!

        First, will this work on 64 bit N++?

        I had some trouble finding a version of Python Script that was compatible but I managed to find a beta version.

        also, I’m getting this error.

        Traceback (most recent call last):
        File “C:\Users\mmiller\AppData\Roaming\Notepad++\plugins\Config\PythonScript\scripts\create_strings.py”, line 4, in <module>
        import ctypes
        File “C:\Program Files\Notepad++\plugins\PythonScript\lib\ctypes_init_.py”, line 7, in <module>
        from _ctypes import Union, Structure, Array
        ImportError: No module named _ctypes

        E 1 Reply Last reply Feb 14, 2019, 5:06 PM Reply Quote 1
        • E
          Eko palypse @Michael Miller31
          last edited by Feb 14, 2019, 5:06 PM

          Yes, as I’m using x64 version as well.
          Where did you download pythonscript plugin from?
          Why didn’t you use Plugin Manager?
          The official release channel for python script plugin is here.

          1 Reply Last reply Reply Quote 2
          • M
            Michael Miller31
            last edited by Feb 14, 2019, 5:32 PM

            I don’t have plugin manager so I went through http://docs.notepad-plus-plus.org/index.php?title=Plugin_Central .

            Thanks for dealing with my idiocy. Going through plugin manager worked perfectly. Is there any way I can donate for your time?

            M 1 Reply Last reply Feb 14, 2019, 5:37 PM Reply Quote 4
            • M
              Meta Chuh moderator @Michael Miller31
              last edited by Feb 14, 2019, 5:37 PM

              @Michael-Miller31

              Is there any way I can donate for your time?

              yes, we urgently need 5 macbook pro’s. 👍
              thanks in advance. 😂

              E 1 Reply Last reply Feb 14, 2019, 5:43 PM Reply Quote 0
              • E
                Eko palypse
                last edited by Feb 14, 2019, 5:41 PM

                Thank you very much for asking and yes there is one thing
                you could do if you like :-)
                It might sound strange but if you have or know a cooking recipe
                which is worth testing - I would appreciate.
                I know tastes are different so … :-)

                1 Reply Last reply Reply Quote 1
                • E
                  Eko palypse @Meta Chuh
                  last edited by Feb 14, 2019, 5:43 PM

                  @Meta-Chuh

                  REALLY - macbooks … NOWADAYS … :-D

                  1 Reply Last reply Reply Quote 0
                  • M
                    Michael Miller31
                    last edited by Feb 14, 2019, 5:59 PM

                    I will get you a recipe when I get home from work. :-)

                    The macbooks will take some time. :-D

                    E 1 Reply Last reply Feb 15, 2019, 10:54 PM Reply Quote 2
                    • M
                      Michael Miller31
                      last edited by Feb 14, 2019, 11:40 PM

                      https://imgur.com/a/GWRaqec @Eko-palypse here’s my favorite recipe for muffins. :-D

                      Thanks again for your help.

                      I also realized afterwards that there are a few internal functions that end with $ and don’t start with fn but I just modified the regex to take care of them.

                      E A 2 Replies Last reply Feb 14, 2019, 11:43 PM Reply Quote 4
                      • E
                        Eko palypse @Michael Miller31
                        last edited by Feb 14, 2019, 11:43 PM

                        @Michael-Miller31

                        thank you thank you very much - very much appreciated - I LOVE MUFFINS (who doesn’t ?)
                        And also nice to see that you already made the script do what you want.
                        Have a nice day.

                        1 Reply Last reply Reply Quote 1
                        • A
                          Alan Kilborn @Michael Miller31
                          last edited by Feb 15, 2019, 12:21 AM

                          @Michael-Miller31

                          Much better to have an actual recipe than simply all the talk of “baking cookies” that goes on around here sometimes!

                          1 Reply Last reply Reply Quote 3
                          • E
                            Eko palypse
                            last edited by Feb 15, 2019, 12:23 AM

                            Help, I need somebody help I need somebody heeeelllppp :-D

                            M 1 Reply Last reply Feb 15, 2019, 2:16 PM Reply Quote 1
                            • M
                              Meta Chuh moderator @Eko palypse
                              last edited by Feb 15, 2019, 2:16 PM

                              @Eko-palypse

                              yesterday … all my troubles seemed so far away :-D

                              1 Reply Last reply Reply Quote 1
                              • A
                                Alan Kilborn
                                last edited by Feb 15, 2019, 2:17 PM

                                I see the Beatles song lyrics references, but I’m unsure why Eko started it??

                                E 1 Reply Last reply Feb 15, 2019, 10:58 PM Reply Quote 0
                                • E
                                  Eko palypse @Michael Miller31
                                  last edited by Eko palypse Feb 15, 2019, 10:55 PM Feb 15, 2019, 10:54 PM

                                  @Michael-Miller31

                                  I found a little bug in the script.
                                  The area which needs to be styled is wrongly calculated if there are folded parts within this area.
                                  Please replace, within the style function, this line
                                  end_line = start_line + editor.linesOnScreen()
                                  with that line
                                  end_line = editor.docLineFromVisible(start_line + editor.linesOnScreen())

                                  1 Reply Last reply Reply Quote 3
                                  • E
                                    Eko palypse @Alan Kilborn
                                    last edited by Feb 15, 2019, 10:58 PM

                                    @Alan-Kilborn said:

                                    I see the Beatles song lyrics references, but I’m unsure why Eko started it??

                                    because this was the first thing which came into my mind after reading your comment about Scott-Sumner’s baking cookie comments :-D

                                    1 Reply Last reply Reply Quote 1
                                    • guy038G
                                      guy038
                                      last edited by guy038 Feb 16, 2019, 11:11 PM Feb 16, 2019, 11:09 PM

                                      Hello, @michael-miller31, @eko-palypse, @alan-kilborn, @meta-chuh and All,

                                      Eko, I’ve just tried your python script and it works fine :-))

                                      I was a bit intrigued by your regex and I wanted to test other syntaxes. But after a while, I understood that your just take care of group 1 and dismiss the solution fn[A-Za-z0-9_]+?\$ Don’t you ?

                                      I tested this other solution (\b(?!fn)\w+\$), with success ! Of course, we could get rid of the group 1 but I suppose that your script should be slightly modified !


                                      Secondly, I tried to build, from the michael’s picture and text, an equivalent UDL, what I named… EKO and after some tests I was surprised because, although I just missed to update the UDL name, in your script, as below :

                                                  self.lexer_name = 'User Defined language file - EKO'
                                      

                                      Seemingly, it does not care about it ?! ( Just a comment : my BR Basic test file has no extension and I didn’t associate the EKO UDL to a specific extension )

                                      Cheers,

                                      guy038

                                      E 1 Reply Last reply Feb 16, 2019, 11:14 PM Reply Quote 3
                                      • E
                                        Eko palypse @guy038
                                        last edited by Eko palypse Feb 16, 2019, 11:15 PM Feb 16, 2019, 11:14 PM

                                        @guy038

                                        thanks for testing and sharing an alternative regex.
                                        Concerning the script, if you just run the script it will flag the current
                                        document being of interest.
                                        If you would open multiple UDL documents and switch between them,
                                        then you should see that those documents work only if the UDL name
                                        is the one configured in the script.

                                        1 Reply Last reply Reply Quote 1
                                        • Alexander SeidelA
                                          Alexander Seidel
                                          last edited by Oct 8, 2019, 3:19 PM

                                          Thanks for this great piece of code, Eko, I had a very similar problem, and simply changed the symbol and the color in the relevant line to fit my case.

                                          I was just wondering if you could help me with two additions, if it isn’t too much work to integrate:

                                          1. I have some cases where I don’t just want to change the color of the text, but also change the text from italic to non italic:
                                            int( —> int(
                                            Is this possible?

                                          2. In an ideal case, I would like comment lines to be excluded from this. In my case every line that start with, or contains # would have to be ignored by the python script.

                                          Thanks in advance, and have a nice day :)

                                          EkopalypseE 2 Replies Last reply Oct 8, 2019, 3:34 PM Reply Quote 0
                                          • First post
                                            Last post
                                          The Community of users of the Notepad++ text editor.
                                          Powered by NodeBB | Contributors