1

Notepad++ has a Function List feature that allows for quick jumping to functions. This is all fine and dandy, but I find that if I'm working in JavaScript and use anonymous functions, then it quickly becomes very silly; my current file has almost 100 instances of "function" in the list!

I know that it has a filter, but that only allows you to search for a specific function. Is there a way I can filter out anonymous functions (or any function names in general)?

2

You can modify the regular expression that finds the functions (see Notepad++ help).

Find the js_function parser and change the first nameExpr inside the functionName element from

"[_A-Za-z][\w_]*[\s]*[=:]|[_A-Za-z]?[\w_]*[\s]*\("

to

"[_A-Za-z][\w_]*[\s]*[=:]|(?<=function )[_A-Za-z]?[\w_]*[\s]*\("

This adds a lookbehind to the expression, ensuring that the word "function " (including a space) precedes the function name. If it doesn't, it's an anonymous function and will not show up in the function list.

  • 1
    Excellent! David Blanchard's answer worked like a charm. BTW - the file that David is referring to is functionList.XML and is found in: C:\Users\<USER NAME>\AppData\Roaming\notepad++ – user397728 Dec 10 '14 at 17:01
  • Oh wow, I didn't even see this answer. Thanks, it works great! – Schism Aug 23 '15 at 13:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.