Configure Function List to show JavaScript class functions created with prototype



  • Looked around for help on setting up functionList.xml to get it to display JavaScript classes set up using the prototype keyword and couldn’t find anything. Also wanted to suppress the listing of blank anonymous functions and found a tweak on http://superuser.com/questions/759322/how-can-i-filter-out-from-function-list. For what it is worth, here is my parser section:

    <parser id="js_function" displayName="Javascript" commentExpr="((/\*.*?\*)/|(//.*?$))"> <function mainExpr="((^|[\s]+|[;\}\.])([_A-Za-z][\w_]*\.)*[_A-Za-z][\w_]*[\s]*=|^|[\s;\}]+)[\s]*function([\s]+[_A-Za-z]?[\w_]*\([^\)\(]*\)|\([^\)\(]*\))[\n\s]*\{" displayMode="$className->$functionName"> <functionName> <nameExpr expr="[_A-Za-z][\w_]*[\s]*[=:]|(?<=function )[_A-Za-z]+[\w_]*[\s]*\("/> <nameExpr expr="[_A-Za-z]+[\w_]*"/> </functionName> <className> <nameExpr expr="([_A-Za-z][\w_]*\.)*[_A-Za-z][\w_]*\."/> <nameExpr expr="([_A-Za-z][\w_]*\.)*[_A-Za-z][\w_]*"/> </className> </function> <classRange mainExpr="^[\t ]*([_A-Za-z]?[\w_]*)(\.prototype)+[\s]+(=)+[\s]*\{" openSymbole = "\{" closeSymbole = "\}" displayMode="node"> <className> <nameExpr expr="[_A-Za-z]+[\w_]*"/> </className> <function mainExpr="^[\t ]*([_A-Za-z]?[\w_])+[\s]*+:+[\s]*+function+[\s]*\("> <functionName> <funcNameExpr expr="^[\t ]*([_A-Za-z]?[\w_]*)"/> </functionName> </function> </classRange> </parser>


Log in to reply