This is a guide on how to enable the “Function List” feature in Notepad++ when editing CATScript source code files.
Notepad++ ‘Function List’ for CATScript (and VBS)
Purpose
As I have been using the Notepad++ text editor for quite some time, I was unaware of the “Function List” feature, which is quite helpful in navigating through source code.
Upon activation, the “Function List” feature works seamlessly for most known programming languages. However, when selecting Visual Basic as the programming language, the window remains empty and fails to display any of the language-specific functions.
‘Function List’ configuration
The language specific declaration files are available in the following directory:
%APPDATA%\Notepad++\functionList
… copy the string and paste it into the Explorer entry window to jump to this directory right away …
The full pathname for example might look like: C:\Users<USER>\AppData\Roaming\Notepad++\functionList
What’s missing here is the vb.xml declaration file which enables the language parser to interpret the source code dialect correctly.
Declaration file - vb.xml
Declaration file source:
<?xml version="1.0" encoding="UTF-8" ?>
<!--
To learn how to make your own language parser, please check the following links:
- https://npp-user-manual.org/docs/function-list/
- http://sourceforge.net/p/notepad-plus/patches/613/
Credits:
Thanks to Jiří Basler for his community entry under:
- https://community.notepad-plus-plus.org/topic/20386/vb-script-function-list
-->
<NotepadPlus>
<functionList>
<parser
displayName="Visual Basic (.NET|Script|for Applications)"
id ="vb_function"
commentExpr="(?m:((?<=').*?$)|((?i:REM)([\t ].*?)?$))">
<classRange
mainExpr="(?s:(?<SCOPE>(?i:CLASS|TYPE)).*?(?i:END[\t ]\k<SCOPE>))"
displayMode="node">
<className>
<nameExpr expr="(?i:CLASS|TYPE)[\t ]+(?:[A-Za-z_][\w]*\b)(?:.*?[\r\n])"/>
<nameExpr expr="[\t ]+(?:[A-Za-z_][\w]*\b)"/>
<nameExpr expr="[A-Za-z_][\w]*"/>
</className>
<function
mainExpr="(?m:^[\t ]*(?i:(?:(?:PUBLIC|PRIVATE|PROTECTED|FRIEND|PROTECTED FRIEND)[\t ]+)?(?:(?:STATIC|SHARED|SHADOWS|OVERRIDABLE|OVERRIDES|READONLY|WRITEONLY)[\t ]+)?(?:SUB|FUNCTION|PROPERTY)).*?(?:\(|$))">
<functionName>
<funcNameExpr expr="(?i:(?:(?:PUBLIC|PRIVATE|PROTECTED|FRIEND|PROTECTED FRIEND)[\t ]+)?(?:STATIC[\t ]+)?(?:SUB|FUNCTION|PROPERTY)).*?(?:\(|$)"/>
<funcNameExpr expr="(?i:(?:SUB|FUNCTION|PROPERTY)).*?(?:\(|$)"/>
<funcNameExpr expr="(?i:(?:GET|LET|SET)[\t ]+)?[A-Za-z_][\w]*(?=[\t ]*\()"/>
</functionName>
</function>
</classRange>
<function
mainExpr="^[\t ]*(?i:(?:(?:PUBLIC|PRIVATE|PROTECTED|FRIEND|PROTECTED FRIEND)[\t ]+)?(?:(?:STATIC|(?:DECLARE(?:[\t ]+(ANSI|UNICODE|AUTO))?))[\t ]+)?(?:SUB|FUNCTION|PROPERTY)).*?(?:\(|$)"
displayMode="$functionName">
<functionName>
<nameExpr expr="(?i:(?:(?:PUBLIC|PRIVATE|PROTECTED|FRIEND|PROTECTED FRIEND)[\t ]+)?(?:(?:STATIC|(?:DECLARE(?:[\t ]+(?:ANSI|UNICODE|AUTO))?))[\t ]+)?(?:SUB|FUNCTION|PROPERTY)).*?(?:\(|$)"/>
<nameExpr expr="(?i:(?:SUB|FUNCTION|PROPERTY)).*?(?:\(|$)"/>
<nameExpr expr="(?i:(?:GET|LET|SET)[\t ]+)?[A-Za-z_][\w]*(?i:[\t ]+(LIB|ALIAS)[\t ]+[\w"\.]+)*(?=[\t ]*\()"/>
</functionName>
</function>
</parser>
</functionList>
</NotepadPlus>
Function List Result Window
After copying the declaration file, the ‘Function List’ finally needs to be activated via the pull-down “View/Function List” dialog setting.
Once done, a dialog window should appear right beside the main dialog window: