Community
    • Login

    FunctionList in 7.9.1

    Scheduled Pinned Locked Moved General Discussion
    18 Posts 5 Posters 2.4k 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.
    • Alan KilbornA
      Alan Kilborn
      last edited by Alan Kilborn

      I haven’t seen discussion yet about the changes in the way FunctionList is specified in 7.9.1 but perhaps I’ve just missed it?

      So FunctionList specification has gotten a lot cleaner/easier!
      That’s a good thing.

      I have a custom specification for “Normal text” files, which is probably unusual, and I was faced with figuring out how to make it work in the new scheme.

      Here’s what I did:

      In ...\functionList\overrideMap.xml near the top we see:

      9c7ca7ff-0d22-4962-b4bb-7620ddb2bdf0-image.png

      I changed it as follows (following the instructions in the comments further down in the overrideMap.xml file):

      031319bc-d897-4f69-9535-30fc3e79c5f4-image.png

      Then I created a new file called, somewhat obviously, normaltext.xml in the ...\functionList\ folder; here’s what that new file looks like:

      071e32cf-23ef-4673-b368-d49825cede9e-image.png

      (I had copied a simple file in the same folder to have a template to make my new file – I chose asm.xml and removed the “assembly language” specific stuff before I started adding my own stuff.)

      I highlighted in yellow the things I changed:

      I used id = "0" because I know from my previous function-list configuration efforts that zero is the id for normal-text.

      For the displayName= I just put a dummy name in; not sure if/where this value would be used by Notepad++ (but what I did didn’t affect how the function-list feature worked, so…good!)

      For the ... part, I put in my own particular function-list regular expression.

      After doing this, and restarting Notepad++, when I looked at a .txt file that my stuff was working for under the old scheme (7.9), I had success under 7.9.1 !

      I noticed the link to the user manual in the comments in the XML, and I went there, but it appears it hasn’t been fully updated yet? I don’t know, but I turned to the “trial and error” method to try to get this working.

      That’s about it; maybe this is helpful to someone else.

      PeterJonesP linpengchengL 2 Replies Last reply Reply Quote 4
      • PeterJonesP
        PeterJones @Alan Kilborn
        last edited by

        @Alan-Kilborn said in FunctionList in 7.9.1:

        it appears it hasn’t been fully updated yet?

        Documentation usually lags any given version, unfortunately. I start working on known updates as soon as RC1 is published, but it’s not always merged with the github master by the time of final release – and I think Don usually doesn’t uprev the website from github for a week or two after final release (but he doesn’t have a set schedule).

        You can always check the github page for updates that haven’t made it to the website yet. Specifically, both https://github.com/notepad-plus-plus/npp-usermanual/blob/master/content/docs/function-list.md and https://github.com/notepad-plus-plus/npp-usermanual/blob/master/content/docs/config-files.md have been updated to discuss the new file arrangement.

        not sure if/where this value would be used by Notepad++

        I think at one point, it would change the “title” of the functionList panel, but it’s been a while since it has actually done that.

        Alan KilbornA 1 Reply Last reply Reply Quote 2
        • Alan KilbornA
          Alan Kilborn @PeterJones
          last edited by

          @PeterJones said in FunctionList in 7.9.1:

          Documentation usually lags any given version

          Understood, no worries.
          Perhaps this thread can be considered the Cliff Notes version of the official docs.
          Real world example -> solved, kind of thing. :-)
          I was a bit “afraid” while experimenting, thinking “this is never gonna work”, but sometimes things work out. :-)

          1 Reply Last reply Reply Quote 1
          • cisco779kC
            cisco779k
            last edited by

            sorry for my intrusion into this post…
            i have see new functionList folder into 7.9.1 version.
            i have read this page https://npp-user-manual.org/docs/function-list/
            but i didn’t understand how to use…
            can anyone explain me how to use these functions? tnxs

            Alan KilbornA 1 Reply Last reply Reply Quote 0
            • Alan KilbornA
              Alan Kilborn @cisco779k
              last edited by Alan Kilborn

              @cisco779k

              You mean, in general, what does the functionlist do?
              Well, typically, in a programming language, code units are divided up into “functions”.
              The functionlist provides an outline view of a file’s data, according to its functions.
              So, for a N++ source file, here’s an example of what you might see:

              96a9ca9e-198e-4b30-a1b4-a4ceb83a1704-image.png

              Here, init, killAllChildren, etc. are the functions.

              Doubleclicking on a function name in this window will jump you in the source code to the definition of that function.

              If you already understand this, and your question was asking something different, please clarify.

              1 Reply Last reply Reply Quote 2
              • cisco779kC
                cisco779k
                last edited by

                tanxs for your reply.
                but how to have this panel? (to run one function)
                or how to run single function?

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

                  @cisco779k said in FunctionList in 7.9.1:

                  i have see new functionList folder into 7.9.1 version.

                  First off, this panel is nothing new to v7.9.1. This version just split the old functionList.xml config file into many files in the functionList folder. The Function List functionality has existed for years in Notepad++ (as long as I can remember)

                  but how to have this panel?

                  Enable it using View > Function List, or the toolbar icon
                  262a3c71-d58f-45b4-be83-60158b7f3904-image.png

                  (to run one function)
                  or how to run single function?

                  It doesn’t run the function. It navigates the Notepad++ editor window to the first line of that function, so you can edit the source code for the function. To get it to navigate to the first line of that function, double-click on the name of the function in the Function List panel, as Alan already told you.

                  1 Reply Last reply Reply Quote 2
                  • linpengchengL
                    linpengcheng @Alan Kilborn
                    last edited by

                    failed to customize markdown & Clojure function list in npp 7.9.1, but success in npp 7.9.

                    failed_fn_list_config_files.zip

                    1 Reply Last reply Reply Quote 0
                    • cisco779kC
                      cisco779k
                      last edited by

                      tanxs Peter for your explanation.
                      but my function list window is empty… how to load function ?

                      Alan KilbornA 1 Reply Last reply Reply Quote 0
                      • Alan KilbornA
                        Alan Kilborn @cisco779k
                        last edited by

                        @cisco779k said in FunctionList in 7.9.1:

                        but my function list window is empty

                        I think you’re going to have to provide some actual information in order for anyone to help you.

                        Examples:

                        • what Language are you using where you want to see functions in the Function List window?

                        • provide a snippet of your code which contains a function definition in the Language, that you are not seeing in the Function List

                        • screenshot of what you are seeing when you look at Function List window

                        Really, you haven’t provided much to go on. See HERE.

                        1 Reply Last reply Reply Quote 0
                        • cisco779kC
                          cisco779k
                          last edited by

                          alt text

                          PeterJonesP Alan KilbornA 2 Replies Last reply Reply Quote 0
                          • PeterJonesP
                            PeterJones @cisco779k
                            last edited by

                            @cisco779k ,

                            Yes, unless you go through the process that @Alan-Kilborn showed in the first post in this topic, Normal Text does not have functions. Notepad++ has no way of knowing how you define a function in Normal Text unless you tell it. Normal Text is not the best way to figure out if the Function List panel is working for you.

                            Further, the document you showed is empty. How do you expect an empty document to define any functions, whatever language it’s supposed to be?

                            If you pick a pre-supported programming language, and open a file of that type (so the Language menu shows it properly selected and the status bar agrees), then the function list will show the defined functions. For example, if I open PerlForFunctionListDebug.pl

                            #!perl
                            
                            use strict;
                            use warnings;
                            
                            sub with_paren() {}
                            sub no_paren_brace {}
                            sub MyPackage::WithParen() {}
                            sub withProto :prototype(\@@) {}
                            sub withAttrib  :Ugly : Duckling : Here {}
                            
                            package MyName;
                            sub InPackage() {}
                            
                            
                            __DATA__
                            sub fake_data_function() {}
                            
                            __END__
                            sub fake_end_function() {}
                            

                            … then I see:
                            62a55edd-1503-48a1-b461-6921e3410b1e-image.png

                            1 Reply Last reply Reply Quote 3
                            • Alan KilbornA
                              Alan Kilborn @cisco779k
                              last edited by

                              @cisco779k

                              Why don’t you download Notepad_plus.cpp from HERE by right-clicking its contents and doing a SaveAs in your browser, and then open this file in Notepad++?

                              Then you should see the following, which MIGHT help you understand this feature by looking at the following:

                              7aa174a2-4ec5-4a06-bf8b-e50e2ef58e37-image.png

                              Alan KilbornA 1 Reply Last reply Reply Quote 3
                              • Alan KilbornA
                                Alan Kilborn @Alan Kilborn
                                last edited by

                                BTW, wow, did I ever select a “violent-sounding” function to use as my example one! :-(

                                1 Reply Last reply Reply Quote 5
                                • cisco779kC
                                  cisco779k
                                  last edited by cisco779k

                                  @PeterJones
                                  i have copy and paste your example on np but…
                                  alt text

                                  @ Alan
                                  Notepad_plus.cpp work. tnxs.
                                  alt text

                                  astrosofistaA 1 Reply Last reply Reply Quote 0
                                  • astrosofistaA
                                    astrosofista @cisco779k
                                    last edited by

                                    Hi @cisco779k

                                    As @PeterJones file example is not saved, you need to manually assing the correct language to the source file, Perl in this case. Once you do that the function list panel will do its job.

                                    But as @Alan-Kilborn file example was saved with an specific extension, Notepad++ automatically assigned the correct language and populate the function list panel.

                                    Hope this helps.

                                    1 Reply Last reply Reply Quote 4
                                    • cisco779kC
                                      cisco779k
                                      last edited by

                                      ok tanxs for explaination! cheers

                                      1 Reply Last reply Reply Quote 0
                                      • linpengchengL
                                        linpengcheng
                                        last edited by

                                        This post is deleted!
                                        1 Reply Last reply Reply Quote 0
                                        • Alan KilbornA Alan Kilborn referenced this topic on
                                        • First post
                                          Last post
                                        The Community of users of the Notepad++ text editor.
                                        Powered by NodeBB | Contributors