#580 Python addition to functionList.xml

Next_release
closed
nobody
6
2014-11-17
2014-05-22
James
No

Hello,

Please consider adding the following XML to functionList.xml. This code is a minimally modified version of Artfunkel's found in this discussion post:

http://sourceforge.net/p/notepad-plus/discussion/482781/thread/515001cd/

In associationMap section:

<association langID="22" id="python_function"/>

In parsers section:

<parser id="python_function" displayName="Python class" commentExpr="(#.*?$|'''.*?('''|\Z))">
    <classRange mainExpr="(?<=^class ).*?(?=\n\S|\Z)">
        <className>
            <nameExpr expr="\w+(?=[\(|:])"/>
        </className>
        <function mainExpr="(?<=def ).+?(?=:)">
            <functionName>
                <funcNameExpr expr=".*"/>
            </functionName>
        </function>
    </classRange>
    <function mainExpr="(?<=def ).+?(?=:)">
        <functionName>
            <funcNameExpr expr=".*"/>
        </functionName>
    </function>
</parser>

Known caveats:

  • it does not do nested classes (noted in Artfunkel's original post)
  • it does not show classes that do not have at least defined function, which isn't uncommon in Django where a model inherits functionality from a superclass and simply provides attributes and no functions of its own. It would be good if the functionlist would support showing and navigating to classes that have no functions

Discussion

  • Menno Vogels

    Menno Vogels - 2014-07-04

    Uhm, I do not see a difference other than the id!?

     
  • Don HO

    Don HO - 2014-08-14
    • status: open --> accepted
    • Priority: 5 --> 6
     
  • Don HO

    Don HO - 2014-09-14
    • Status: accepted --> closed