JavaScript Function List not working



  • Hi, I have the latest version of Notepad++ installed (7.3.2) and I can’t get the function list to display anything when I edit my .js files. I checked the functionList.xml file, and there’s code there for JavaScript, so why doesn’t it work? This is what’s in my functionList.xml file:

    Line 29: L_COFFEESCRIPT = 56 | L_JAVASCRIPT = 58 | L_PS = 35 | L_XML = 9

    Line 38: 3 = L_CPP | 19 = L_JS | 35 = L_PS | 51 = L_GUI4CLI

    Line 45: 10 = L_MAKEFILE | 26 = L_BASH | 42 = L_ADA | 58 = L_JAVASCRIPT

    Line 1165:
    <!-- ================================================ [ J(ava)Script ] -->

    		<parser
    			displayName="JavaScript"
    			id         ="javascript_function"
    			commentExpr="(?s:/\*.*?\*/)|(?m-s://.*?$)"
    		>
    			<function
    				mainExpr="((^|\s+|[;\}\.])([A-Za-z_]\w*\.)*[A-Za-z_]\w*\s*[=:]|^|[\s;\}]+)\s*function(\s+[A-Za-z_]?\w*\([^\)\(]*\)|\([^\)\(]*\))[\n\s]*\{"
    			>
    				<functionName>
    					<nameExpr expr="[A-Za-z_]\w*\s*[=:]|[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>
    		</parser>
    

    Any ideas?





  • Hi thanks for replying to my question! I tried changing the language IDs (58 and 19), trying both functionList.xml files in the two different directories mentioned… but still no list is appearing! What would you suggest I try next?



  • Hi
    I found that javascript function list does not work when there is a comment between the function (parameter list) and the opening curly bracket { of the function body.
    My solution is to remove the search for curly bracket {.
    In addition I added the construct d = new Function(“parameter1”,“parameter2”,“function body”).
    I tried a lot of things, changing the commentExpr did not help. I frequently do have comments between the function header and the opening curly bracket of the function body.

    It concerns the mainExpr

    mainExpr="((^|\s+|[;}.])([A-Za-z_]\w*.)[A-Za-z_]\w\s*[=:]|^|[\s;}]+)\s*(?:new\s*)?function(\s+[A-Za-z_]?\w*\s*([^)(])|([^)(]))"

    (please excuse my formatting, and for tail-posting. I want to post my findings but I’m not fluent).


Log in to reply