User-defined language with function list



  • Hello Npp community,
    since version 7.9.x the functionList.xml doesn’t seem to work anymore.
    Here is a simple language with only 3 commands for demonstration.
    (Function, EndFunction, Print)

    <?xml version="1.0" encoding="UTF-8" ?>
    <NotepadPlus>
        <UserLang name="MyBasic" ext="myb" 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"></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"></Keywords>
                <Keywords name="Folders in code1, middle"></Keywords>
                <Keywords name="Folders in code1, close"></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">Function&#x000D;&#x000A;EndFunction&#x000D;&#x000A;Print&#x000D;&#x000A;</Keywords>
                <Keywords name="Keywords2"></Keywords>
                <Keywords name="Keywords3"></Keywords>
                <Keywords name="Keywords4"></Keywords>
                <Keywords name="Keywords5"></Keywords>
                <Keywords name="Keywords6"></Keywords>
                <Keywords name="Keywords7"></Keywords>
                <Keywords name="Keywords8"></Keywords>
                <Keywords name="Delimiters"></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="000080" bgColor="FFFFFF" fontName="" fontStyle="1" 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>
    

    What do I have to do now so that functions are displayed in the function list?

    Greetings





  • Thanks @Ekopalypse!
    I hadn’t seen the overrideMap.xml.



  • Why is the functionList.xml
    have been replaced?
    I don’t see any great advantages in the new system.



  • @Michael-Suther said in User-defined language with function list:

    Why is the functionList.xml have been replaced?
    I don’t see any great advantages in the new system.

    You don’t?
    The obvious advantage is that before everything was in one file, and now…it’s not.



  • @Michael-Suther said in User-defined language with function list:

    Why is the functionList.xml
    have been replaced?
    I don’t see any great advantages in the new system.

    As with @Alan-Kilborn , I am surprised you don’t see the advantage.

    See this anecdote, between Alice and Bob, with the old system:

    Alice : I have this Function List for my cool GobbledyGoop UDL
    Bob : Cool, how do I use it?
    Alice : Okay, here’s a snippet. Go find a random place in functionList.xml to place it.
    Bob : Okay
    Alice : No, not there. It has to go in the <parsers> section.
    Bob : Is here okay?
    Alice : No, it has to be between the closing </parser> of one parser, and the opening <parser> of another.
    Bob : Ah, okay. Is that all?
    Alice : No, now you have to take this other snippet, and place it in the same file, but in the <associationMap> section
    Bob : Got it.
    Alice : No, you need to have both the userDefinedLanguageName row and a separate row for every extension that GobbledyGoop uses.
    Bob : But doesn’t the GobbledyGoop UDL config already make the mapping from UDL to extension? I like following DRY/SPOT, after all.
    Alice: Yes, but you still need it. Sorry, I didn’t design the system, I just use it.
    Bob : Okay.
    Alice : Now restart Notepad++
    Bob : Cool, it’s working, thanks.

    Now compare that to with the new system:

    Alice : I have this Function List for my cool GobbledyGoop UDL
    Bob : Cool, how do I use it?
    Alice : put GobbledyGoop.xml in %AppData%\Notepad++\functionList\ folder
    Bob : done. Anything else?
    Alice : yep, we have to tell Notepad++ where to look for that file.
    Bob : Makes sense. How?
    Alice : put this one <associationId> line in %AppData%\Notepad++\functionList\, right after the three example UDL rows near the end`
    Bob : Done.
    Alice : Now restart Notepad++
    Bob : Wow! I can see the function list. Thanks for the help!

    Admittedly, I exaggerated. But the new system does make it easier to share function list definitions, IMO. And modularity makes maintenance less confusing. And not having to duplicate the extension-vs-UDL-name entries is a plus to me, too.

    You are allowed your opinion, of course, but I see the advantages of splitting those up.



  • @PeterJones

    Cool. I wonder if Bob and Alice are going to become regular contributors here? :-)


Log in to reply