VB script function list



  • Please, did anyone write a function list for the visual basic script? The old functionList.xml no longer works in the new version of N ++ ;-().



  • I made file vbs.xml:
    <?xml version=“1.0” encoding=“UTF-8” ?>
    <!-- ==========================================================================\

    To learn how to make your own language parser, please check the following
    link:
    https://npp-user-manual.org/docs/function-list/

    |
    =========================================================================== -->
    <NotepadPlus>
    <functionList>
    <!-- ========================================================== [ VBS ] -->

    <!--
    |   Based on:
    |       http://sourceforge.net/p/notepad-plus/patches/613/
    \-->
    <parser
      displayName="Visual Basic (.NET|Script|for Applications)"
      id         ="vb_function"
      commentExpr="(?m:((?&lt;=&apos;).*?$)|((?i:REM)([\t ].*?)?$))"
    >
     <classRange
        mainExpr="(?s:(?&lt;SCOPE&gt;(?i:CLASS|TYPE)).*?(?i:END[\t ]\k&lt;SCOPE&gt;))"
        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&quot;\.]+)*(?=[\t ]*\()"/>
      </functionName>
    </function>
    </parser>
    

    </functionList>
    </NotepadPlus>



  • I reverted to version 7.8.6 now ;-()
    All OK…



  • @Jiří-Basler ,

    You were actually pretty close.

    The old functionList.xml never had a pre-defined VB parser (that I can find in any of my old version zipfiles), so yours is apparently one that you added at some point.

    Looking in old functionList.xml, the language ID constant is 18 for L_VB, which is the language constant for Language > V > Visual Basic.

    Looking in the new overrideMap.xml,

    			<association id= "vb.xml"			 langID= "18"/>
    

    … that same language appears to want vb.xml as the filename, not vbs.xml. To get it to work in v7.9.1, you would either need to rename your file from vbs.xml to vb.xml, or you would need to move the line I showed out of the comment section, and change it to

    			<association id= "vbs.xml"			 langID= "18"/>
    

    … to match your filename, something like:
    5973d5ac-9187-4d4d-8cc7-cc9a409ab866-image.png



  • @Jiří-Basler said in VB script function list:

    I reverted to version 7.8.6 now ;-()

    I have another solution.
    I wrote a lot of development scripts for myself.
    They are in this repository. https://github.com/trdm/jn-npp-scripts
    There is also navigation through the VBS functions.
    alt text



  • @Jiří-Basler ,

    Yes. When I saved a file from this site as tryFunctionList.vb, and saved your vbs.xml as %AppData%\notepad++\functionList\vb.xml (note that it’s vb.xml), then reloaded Notepad++, the Function List displayed:

    29ed23ca-1ed0-40c9-96b9-8ba53785a4ea-image.png

    Similarly, if I renamed it to vbs.xml, edited overrideMap.xml to match the screenshot from my previous post,

    … then exited and re-entered Notepad++, it also parsed the VB function list as shown.

    Either of my suggestions worked for me.


Log in to reply