Community
    • 登入

    Function List: Is file extension of User Defined Language still working?

    已排程 已置頂 已鎖定 已移動 Help wanted · · · – – – · · ·
    16 貼文 5 Posters 1.6k 瀏覽
    正在載入更多貼文
    • 從舊到新
    • 從新到舊
    • 最多點贊
    回覆
    • 在新貼文中回覆
    登入後回覆
    此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
    • donhoD
      donho
      最後由 donho 編輯

      Could anyone confirm the file extension of User Defined Language still working in Function List (with the latest version, of course) ?

      For example:

      <association id= "krl_function"   ext=".src"/>
      <association id= "krl_function"   ext=".sub"/>
      

      in functionList.xml

      Michael VincentM 1 條回覆 最後回覆 回覆 引用 2
      • Michael VincentM
        Michael Vincent @donho
        最後由 Michael Vincent 編輯

        @donho said in Function List: Is file extension of User Defined Language still working?:

        Could anyone confirm the file extension of User Defined Language still working in Function List (with the latest version, of course) ?

        Yes for me. Note I’m on the “bleeding edge” latest version - using the latest commit artifact for 64-bit:

        Notepad++ v7.9 (64-bit)
        Build time : Oct 6 2020 - 14:12:11
        Path : C:\usr\bin\npp64\notepad++.exe
        Admin mode : OFF
        Local Conf mode : ON
        OS Name : Windows 10 Enterprise (64-bit)
        OS Version : 1909
        OS Build : 18363.1082
        Current ANSI codepage : 1252
        Plugins : AutoSave.dll BetterMultiSelection.dll ChangedLines.dll CodeAlignmentNpp.dll ColumnTools.dll ComparePlugin.dll CsvQuery.dll CustomizeToolbar.dll DoxyIt.dll DSpellCheck.dll Explorer.dll GitSCM.dll JSMinNPP.dll NppConsole.dll NppConverter.dll NppExec.dll NppExport.dll NppFTP.dll NppMarkdownPanel.dll NppMenuSearch.dll Python Indent.dll QuickText.dll SurroundSelection.dll TagLEET.dll XMLTools.dll ZoomDisabler.dll

        I have regular function list working:

        a24ac5d0-3681-459a-9bd8-8ee1579c1100-image.png

        I have a “standard” language (ASN.1) for which I created a custom parser working:

        <association id=        "asn1_syntax"     langID="65"                          />
        

        32d0a7c4-6dc9-4a36-9aa3-fea7f2b3671d-image.png

        and I have a user-defined language (UDL Markdown) for which I created a custom parser working:

        <association id=    "markdown"            userDefinedLangName="Markdown"       />
        <association id=    "markdown"            ext=".md"                            />
        

        27e89b01-80c1-4722-a385-059a2d292e59-image.png

        As well as some other UDLs working (NppExec for example) for which I need to select the language type because I don’t specifically have a unique extension (just uses .txt):

        <association id=  "nppexec_syntax"        userDefinedLangName="NppExec"        />
        

        d4fb3883-97f3-4c8b-b752-5c4d8a332f42-image.png

        I don’t have any files of your example (KRL / .src, .sub) to test with, but I think you get the picture. I can provide the parsers as well, but assuming you just wanted to see UDL working in Function List?

        And the new Tab to search box and list view is working great!

        Cheers.

        1 條回覆 最後回覆 回覆 引用 3
        • donhoD
          donho
          最後由 donho 編輯

          @Michael-Vincent said in Function List: Is file extension of User Defined Language still working?:

          <association id= “markdown” ext=“.md” />

          If you remove the above line from your functionList.xml, then restart your Notepad++, your *.md files will still work.

          If you add <association id= "markdown" ext=".xd" /> then rename the ext of your MD files to xd, and open renamed file, your function list will be empty.

          Could you confirm these 2 points?

          Michael VincentM dinkumoilD 2 條回覆 最後回覆 回覆 引用 1
          • Michael VincentM
            Michael Vincent @donho
            最後由 Michael Vincent 編輯

            @donho said in Function List: Is file extension of User Defined Language still working?:

            Could you confirm these 2 points?

            Yes on both accounts, you predict correctly:

            If you remove the above line from your functionList.xml, then restart your Notepad++, your *.md files will still work.

            Removing:

            <association id= “markdown” ext=".md" />
            

            and then starting Notepad++ and opening the Markdown file, Function List still shows the parsed Markdown headers (like my picture above). Assuming because I have “.md” as a file extension in the User Defined Language config:

            a7cf7f77-59ee-4e9b-9e3c-820be35a51f7-image.png

            ===

            If you add <association id= "markdown" ext=".xd" /> then rename the ext of your MD files to xd, and open renamed file, your function list will be empty.

            Adding the line in functionList.xml, opening Notepad++ and then opening a renamed README.xd (from the original README.md) does not show in Function List - the panel is empty.

            Hope this helps!

            Cheers.

            1 條回覆 最後回覆 回覆 引用 2
            • donhoD
              donho
              最後由 編輯

              @Michael-Vincent Thank you very much for your help!

              1 條回覆 最後回覆 回覆 引用 2
              • dinkumoilD
                dinkumoil @donho
                最後由 dinkumoil 編輯

                @donho , @Michael-Vincent

                When I’ve created a NppExec script UDL and also a function list parser, I noticed that it is necessary to have an UDL in order to get a working function list. It seems the function list parser is not triggered by the file’s extension but by the language type which is, of course, only present if one has an UDL.

                @Michael-Vincent

                If you are interested in how to activate NppExec syntax highlighting and function list parser automatically when the file npes_saved.txt is loaded with Notepad++, have a look at >> this comment << in the NppExec bug tracker.

                1 條回覆 最後回覆 回覆 引用 3
                • donhoD
                  donho
                  最後由 編輯

                  @dinkumoil

                  . It seems the function list parser is not triggered by the file’s extension but by the language type

                  I’m doing this ticket:
                  https://github.com/notepad-plus-plus/notepad-plus-plus/issues/4896

                  With ext it makes new implementation more complex so less easy to maintain. Since ext part doesn’t work, I will remove this part.

                  MAPJe71M 1 條回覆 最後回覆 回覆 引用 1
                  • MAPJe71M
                    MAPJe71 @donho
                    最後由 編輯

                    @donho see also #298 and Function List known issue #4

                    donhoD 1 條回覆 最後回覆 回覆 引用 1
                    • donhoD
                      donho @MAPJe71
                      最後由 編輯

                      @MAPJe71
                      Hmm… I think the file ext to apply function list is not necessary anymore. Users can set several exts in UDL, and once the file is recognized as UDL, function list will work on it if its parser is present.

                      MAPJe71M 1 條回覆 最後回覆 回覆 引用 1
                      • ArkadiuszMichalskiA
                        ArkadiuszMichalski
                        最後由 編輯

                        So to have working list we need two things, a parser and a UDL file (even without styles)?

                        1 條回覆 最後回覆 回覆 引用 0
                        • ArkadiuszMichalskiA
                          ArkadiuszMichalski
                          最後由 編輯

                          Although in the case of UDL it’s obvious. There was no question.

                          1 條回覆 最後回覆 回覆 引用 0
                          • MAPJe71M
                            MAPJe71 @donho
                            最後由 編輯

                            @donho
                            The problem of FL ext not working is that it requires an UDL i.e. you can’t use an FL parser without an UDL.

                            1 條回覆 最後回覆 回覆 引用 0
                            • MAPJe71M
                              MAPJe71
                              最後由 編輯

                              @ArkadiuszMichalski appearently beat me to it.
                              You need both FL parser and UDL (can be a “dummy” i.e. with name and extension but without styles) because FL ext does not work.

                              1 條回覆 最後回覆 回覆 引用 0
                              • MAPJe71M
                                MAPJe71
                                最後由 編輯

                                Furthermore, for every UDL FunctionList parser deployed with Notepad++ you would also have to include the UDL definition in order for those parsers to work.

                                1 條回覆 最後回覆 回覆 引用 0
                                • donhoD
                                  donho
                                  最後由 donho 編輯

                                  So to have working list we need two things, a parser and a UDL file (even without styles)?

                                  Yes. Set an empty UDL with the exts + the name via the UDL dialog - it took me 5 seconds only.

                                  Furthermore, for every UDL FunctionList parser deployed with Notepad++ you would also have to include the UDL definition in order for those parsers to work.

                                  Not necessary. A simple explanation in npp-user-manual will be enough.

                                  1 條回覆 最後回覆 回覆 引用 0
                                  • ArkadiuszMichalskiA
                                    ArkadiuszMichalski
                                    最後由 編輯

                                    @donho But few UDL is not problem, what if someone has to make a lot of them and gets a trash on the menu?
                                    https://github.com/notepad-plus-plus/notepad-plus-plus/issues/4896#issuecomment-706421610

                                    1 條回覆 最後回覆 回覆 引用 1
                                    • 第一個貼文
                                      最後的貼文
                                    The Community of users of the Notepad++ text editor.
                                    Powered by NodeBB | Contributors