Community
    • Login

    Function list for UDL not working after 7.9.2 update (despite following new procedure)

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    function listudl
    9 Posts 4 Posters 768 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.
    • stata_userS
      stata_user
      last edited by

      Hi,

      I use Notepad++ to code in Stata, a statistical package. Before 7.9.2 I used to have a rudimentary function list configuration that would create sections in my workflows, so that I could easily jump to specific locations. Following an update to 7.9.2 forced by my IT department, this functionality is now broken and I am not able to restore it. I have read this related post and followed the instructions, but to no avail.

      Here is my setup: I have Notepad++ 7.9.2 32-bit. I do not have admin rights on this particular machine so I am working on files in the %appdata% path (but I also failed at this with admin rights, on a separate machine). I defined my STATA UDL using the UDL interface:udl.png
      I then added the following line to the %appdata%\Notepad++\functionList\overrideMap.xml config file:

      <association id= "stata.xml"            userDefinedLangName="STATA"/>
      

      This then leads to the file %appdata%\Notepad++\functionList\stata.xml, which looks as follows:

      <?xml version="1.0" encoding="UTF-8" ?>
       <NotepadPlus>
      	<functionList>
      		<!-- ====================================================== [ Stata ] -->
      			<parser 
      				displayName="STATA"
      				id="stata_syntax"  
      				commentExpr="((/\*.*?\*)/|(//.*?$))"
      			>
      				<function
      				    mainExpr="^[\t]*[\s]*(\*\-+\+*)[\s]*.*\*$"
      					displayMode="$functionName"
      					>
      					<functionName>
      						<nameExpr expr="(\([A-Z0-9][0-9]?[0-9]?\)[\t\s]*[\w]+[\w\s\t\-:]*)[\t\s\-\+]"/>
      					</functionName>
      				</function>
      			</parser>
      	</functionList>
      </NotepadPlus>
      

      This simple parser is supposed to find and pin comment blocks like:

      *-------+---------+---------+---------+/**/---------+---------+---------+---------+--------*
      *--------+--------+  	 			(A) Setup workspace    +---------+--------*
      *--------+--------+---------+---------+---------+---------+---------+---------+--------*/
      

      which I use to section my code. What am I doing wrong?

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

        @stata_user ,

        It works for me.

        When I have the text below, and everything set up as you described,

        *-------+---------+---------+---------+/**/---------+---------+---------+---------+--------*
        *--------+--------+  	 			(A) Setup workspace    +---------+--------*
        *--------+--------+---------+---------+---------+---------+---------+---------+--------*/
        something else
        *-------+---------+---------+---------+/**/---------+---------+---------+---------+--------*
        *--------+--------+  	 			(B) Some Other Comment    +---------+--------*
        *--------+--------+---------+---------+---------+---------+---------+---------+--------*/
        something else
        

        I get 0afbda91-676a-4e71-8913-f5d5071b50ff-image.png

        I tried this both with a Notepad++ v7.9.2 using %appdata%, and my normal portable v7.9.4 which uses the local/portable config directory instead of using %appdata%. Both got the same results. Both worked for me.

        Are you sure that your <association> in the override map isn’t accidentally commented out? It should look something like: 747b0f5f-ac40-445c-9c9b-f25f37352997-image.png

        Did you remember to restart Notepad++ after making the changes to overrideMap.xml and stata.xml? Are you sure your file is being recognized as a STATA file (lower-left of status bar, like in my first example, should indicate the STATA user defined language type)?

        stata_userS 1 Reply Last reply Reply Quote 2
        • stata_userS
          stata_user @PeterJones
          last edited by

          Thank you very much @PeterJones. I can confirm that I restarted Notepad++ (and my laptop) several times. In addition, my copy of overrideMap.xml looks similar to yours:overridemap.png
          The file is also correctly recognised:
          association.png
          Could it be the case that I am manipulating the wrong files? Below my debug info:

          Notepad++ v7.9.2 (32-bit)
          Build time : Dec 31 2020 - 03:58:36
          Path : C:\Program Files (x86)\Notepad++\notepad++.exe
          Admin mode : OFF
          Local Conf mode : OFF
          OS Name : Windows 10 Enterprise (64-bit)
          OS Version : 1909
          OS Build : 18363.1377
          Current ANSI codepage : 1252
          Plugins : AutoSave.dll FingerText.dll JSMinNPP.dll mimeTools.dll NppConverter.dll NppExport.dll NPPJSONViewer.dll PyNPP.dll

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

            @stata_user

            Could it be the case that I am manipulating the wrong files?

            That’s the only thing I can think of – but I cannot think why, because your debug info says that it should be using the %AppData%, which you think is what’s being edited.

            But let’s run an independent experiment, to make sure we eliminate some variables.

            1. Download fresh v792-32 zipfile (portable) and unzip into a known writeable location (like a folder on your desktop)
            2. Copy your stata.xml to <unzipped-location>\functionList\stata.xml
            3. Copy your overrideMap.xml over <unzipped-location>\functionList\overrideMap.xml
            4. Close all instances of Notepad++
            5. Run the portable notepad++.exe
            6. Add your STATA UDL
            7. Open your example .do file, and open the Function List panel, and see if it works.

            When I follow those steps, I get the results that I’ve screenshoted above.

            stata_userS 1 Reply Last reply Reply Quote 4
            • stata_userS
              stata_user @PeterJones
              last edited by

              @PeterJones that did the trick: since the portable version worked perfectly, I then went on and made a backup of my %appdata%\Notepad++ folder and deleted all of its content, in an attempt to reset my installed Notepad++.

              I re-installed my UDL, language mapping and function list files as per your list above and now everything seems to work again also on my installed version. Perhaps some config or plugin clutter from the previous versions had created a conflict. Luckily, restoring the backup copies of config.xml, session.xml, stylers.xml and shortcuts.xml did not break this functionality again, so it’s case closed for me.

              Thank you for your help!

              1 Reply Last reply Reply Quote 4
              • jbenhJ
                jbenh
                last edited by

                This post is deleted!
                1 Reply Last reply Reply Quote 0
                • PeterJonesP
                  PeterJones
                  last edited by

                  @jbenh said in Function list for UDL not working after 7.9.2 update (despite following new procedure):

                  I have a similar issue after upgrading.

                  (still replying, even after post deleted, due to sunk cost fallacy)

                  Your problem is at least slightly different. When I set a new v7.9.5-64bit unzip up the way you described, Notepad++ didn’t even recognize the “autoprod” User Defined Language. Without that, it’s not going to be able to do Function List based on the autoprod rules.

                  Looking at your UDL definition, it is missing the <Styles>...</Styles> section. I modified your listed file to use the default styles settings:

                  <NotepadPlus>
                      <UserLang name="autoprod" ext="scr tra" udlVersion="2.1">
                          <Settings>
                              <Global caseIgnored="yes" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
                              <Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
                          </Settings>
                          <KeywordLists>
                              <Keywords name="Comments">00// 00*&amp; 00/* 00//= 01 02 03 04</Keywords>
                              <Keywords name="Numbers, prefix1"></Keywords>
                              <Keywords name="Numbers, prefix2"></Keywords>
                              <Keywords name="Numbers, extras1"></Keywords>
                              <Keywords name="Numbers, extras2"></Keywords>
                              <Keywords name="Numbers, suffix1"></Keywords>
                              <Keywords name="Numbers, suffix2"></Keywords>
                              <Keywords name="Numbers, range"></Keywords>
                              <Keywords name="Operators1">( )</Keywords>
                              <Keywords name="Operators2"></Keywords>
                              <Keywords name="Folders in code1, open">&gt;sql &gt;scr &gt;start &gt;record</Keywords>
                              <Keywords name="Folders in code1, middle"></Keywords>
                              <Keywords name="Folders in code1, close">&gt;end</Keywords>
                              <Keywords name="Folders in code2, open"></Keywords>
                              <Keywords name="Folders in code2, middle"></Keywords>
                              <Keywords name="Folders in code2, close"></Keywords>
                              <Keywords name="Folders in comment, open"></Keywords>
                              <Keywords name="Folders in comment, middle"></Keywords>
                              <Keywords name="Folders in comment, close"></Keywords>
                              <Keywords name="Keywords1">add</Keywords>
                              <Keywords name="Keywords2">AND</Keywords>
                              <Keywords name="Keywords3">commit rollback ; = #else #ifdef #ifndef #endif</Keywords>
                              <Keywords name="Keywords4">ABBINEXCH</Keywords>
                              <Keywords name="Keywords5"></Keywords>
                              <Keywords name="Keywords6"></Keywords>
                              <Keywords name="Keywords7"></Keywords>
                              <Keywords name="Keywords8"></Keywords>
                              <Keywords name="Delimiters">00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23</Keywords>
                          </KeywordLists>
                          <Styles>
                              <WordsStyle name="DEFAULT" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                              <WordsStyle name="COMMENTS" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                              <WordsStyle name="LINE COMMENTS" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                              <WordsStyle name="NUMBERS" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                              <WordsStyle name="KEYWORDS1" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                              <WordsStyle name="KEYWORDS2" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                              <WordsStyle name="KEYWORDS3" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                              <WordsStyle name="KEYWORDS4" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                              <WordsStyle name="KEYWORDS5" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                              <WordsStyle name="KEYWORDS6" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                              <WordsStyle name="KEYWORDS7" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                              <WordsStyle name="KEYWORDS8" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                              <WordsStyle name="OPERATORS" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                              <WordsStyle name="FOLDER IN CODE1" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                              <WordsStyle name="FOLDER IN CODE2" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                              <WordsStyle name="FOLDER IN COMMENT" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                              <WordsStyle name="DELIMITERS1" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                              <WordsStyle name="DELIMITERS2" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                              <WordsStyle name="DELIMITERS3" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                              <WordsStyle name="DELIMITERS4" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                              <WordsStyle name="DELIMITERS5" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                              <WordsStyle name="DELIMITERS6" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                              <WordsStyle name="DELIMITERS7" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                              <WordsStyle name="DELIMITERS8" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                          </Styles>
                      </UserLang>
                  </NotepadPlus>
                  

                  When I restarted the npp 7.9.5, “autoprod” started showing up in my list of UDL. And when I created blah.scr from your sample data file:
                  c429aa0f-c7b6-4dd8-8d5b-2045c6c780b1-image.png
                  … ie, it found two of the three “functions”

                  Looking at your regexes, I noticed two things:

                  ^>(record\n|RECORD\n)|>(SCR|scr|SQL|sql|start field|START FIELD)[\s]+[\*\w\.\-\_\x24]+[\s|\n]
                  (record\n|RECORD\n)|(SCR|scr|SQL|sql|field|FIELD)[\s]+[\*\w\.\-\_\x24]+[\s|\n]
                  
                  1. The record entry required a single \n. However, if your file uses windows newlines \r\n, that might not work. I replaced all your \n with \R (which, in Notepad++'s regex language means any newline sequence, including \r, \n, or \r\n).
                    ^>(record\R|RECORD\R)|>(SCR|scr|SQL|sql|start field|START FIELD)[\s]+[\*\w\.\-\_\x24]+[\s|\R]
                    (record\R|RECORD\R)|(SCR|scr|SQL|sql|field|FIELD)[\s]+[\*\w\.\-\_\x24]+[\s|\R]
                    
                    After making this change and reloading Notepad++, I now get all three: e0279d23-b0cb-412a-b73f-8c01a197f93d-image.png
                  2. Not as critical, but [\s|\n] (or now, [\s|\R]) might not be doing what you think. Inside of parentheses (), the | means logical-OR, for doing alternatives; inside a character class inside square brackets [], the | is just a literal character. So [\s|\n] matches any space character, the vertical bar, or the newline. Further, \s includes \n, because newlines are spaces to the regex engine. If you don’t want the | to be allowed their, that whole character class can be converted to \s – it doesn’t even need to be in the [\s], because \s already matches any space character (space, tab, newline, and some other weird ones). Similarly, your [\s]+ can be changed to \s+.
                          <function  mainExpr="^>(record\R|RECORD\R)|>(SCR|scr|SQL|sql|start field|START FIELD)\s+[\*\w\.\-\_\x24]+\s"	
                                      displayMode="$functionName">
                            <functionName>
                              <nameExpr expr="(record\R|RECORD\R)|(SCR|scr|SQL|sql|field|FIELD)\s+[\*\w\.\-\_\x24]+\s"/>
                            </functionName>
                          </function>
                    
                    (I don’t think the final \s buys you anything, but it doesn’t hurt.)

                  (For future readers: sorry, I don’t have a fully copy of @jbenh’s original post, so I cannot give full context.
                  That’s a drawback of allowing people to delete posts or replies.)

                  1 Reply Last reply Reply Quote 0
                  • guy038G
                    guy038
                    last edited by

                    Hello, @peterjones,

                    If you want to, as a moderator, I may send you the contents of @jbenh’s post, by e-mail. Do you agree with this ?

                    BR

                    guy038

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

                      @guy038 ,

                      I don’t think that’s necessary. There’s probably enough in my post to re-create the original problem for anyone who was that curious. And I’ve left my reply public in case @jbenh ever comes back and wants the 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