MVVS: MV Basic for Visual Studio

 View Only

 Rocket MV Basic (VS Code Extension)

Jump to Best Answer
  •   MV Tools
  •   MVBasic
  •   VSCode
Aaron Glover's profile image
Aaron Glover posted 12-17-2021 01:29
Hi,

I develop solutions using SB+ and there are some common variables which are imported into just about every BASIC program that I have. Some examples are;
 
     $INCLUDE DMSKELCODE COMMON
     $INCLUDE DMSKELCODE STANDARD.EQU

Can someone please tell me why my "INCLUDES" configuration is not working?
COMMON Variables such as RECORD, WORK, CNT, USERDATA() etc are not detected and I get Errors in VSCODE such as;

"Referenced undefined variable: RECORD"
Please see below a redacted version of my configuration. I believe the key parts of the configuration, namely the ACCOUNTS and INCLUDEMAPPINGS are configured correctly.
{
    "version": "1.0",

    // If you want to connet to a U2 server, you need configure the settings in "db" section. 
    // If left these settings empty, you still can use most of the features. If so, 
    // when try to connect to a U2 server, you need input these values in VS Code pop up input box.
    // For more information, please refer https://rocketsoftware.github.io/rocket-mvbasic/usage/Connection
    "db": {

// REMOVED FOR SECURITY REASONS

        // The extension uses unirpc to connect U2 server. 31438 is the default port
        // of unirpc. If the port number is changed in U2 server, you need make sure
        // the port number here the same to server side, so the connection could be
        // established successfully.
        "port": 31438
    },

    // You can add additional account folders here. 
    // Doing this allows other features to reference the source code in these account folders.
    // For example, settings of "catalog" or "includeMapping" can reference these accounts settings.
    // For more details, please refer https://rocketsoftware.github.io/rocket-mvbasic/usage/Accounts/
    "accounts": [
        {
            // Account name. For example, "XDEMO", "HS.SALES", "demo", etc.
            "name": "SB+.DEFN" ,

            // The full path of the account's folder on local machine.
            // For example, "C:\\U2\\UV\\XDEMO", "/usr/username/u2/ud82/demo".
            "path": "C:\\SBPLUS\\SB+.DEFN"
        },
        {
            "name": "SB+" ,
            "path": "C:\\SBPLUS\\SB+"
        }
    ], 

// CATALOG and PROGRAM MAPPING REMOVED FOR BREVITY

    // When a BASIC program includes some other files by using the INCLUDE statement, 
    // you can update this setting so that the included files could be referenced correctly.
    // If you don't care about included files and its source code, you can remove this section.
    // Please refer more details at https://rocketsoftware.github.io/rocket-mvbasic/usage/Include/
    "includeMapping": [
        {

            // The mapped name of a folder in the INCLUDE statement.
            // For example, "$INCLUDE UNIVERSE.INCLUDE HEADER", "UNIVERSE.INCLUDE" is a mapped name, 
            // it's mapping to a folder somewhere on the disk, it's not a real folder name.
            // If there is no mapping relationship, this setting could be removed.
            "includeFile": "DMSKELCODE",

            // Account name. Account name should be configured in "accounts" section.
            // This setting could be removed if the included files are not in other accounts.
            "account": "SB+.DEFN",

            // The name of the folder which contains source code files.
            // This is the real folder name on the disk.
            // For example, "$INCLUDE UNIVERSE.INCLUDE HEADER", "UNIVERSE.INCLUDE" maps to folder
            // "include", so the value for "fileName" should be "include".
            "fileName": "COMMON"
        },
        {
            "includeFile": "DMSKELCODE",
            "account": "SB+.DEFN",
            "fileName": "STANDARD.EQU"
        },
        {
            "includeFile": "TUBP",
            "account": "SB+.DEFN",
            "fileName": "TU.API.H"
        }

    ]
}


Thanks In Advance

Aaron

#MVTools #MVBasic #VSCode
​​​​​

Chao Han's profile image
ROCKETEER Chao Han Best Answer
Hi, Aaron.

Thanks for using our extension, may I know the Windows file path for the included files?

The account information looks ok here but the included file information may not correct. Based on the include statement "$INCLUDE DMSKELCODE COMMON", there is a BASIC file "COMMON" in the "DMSKELCODE" file path, and if "DMSKELCODE" is the actually file name on the Windows side, then the configuration item would like below:
            "includeFile": "DMSKELCODE",
            "account": "SB+.DEFN",
            "fileName": "DMSKELCODE"​

You can change the "filename" parm with the actually Windows filename here. After updated configuration file, please save and reopen the BASIC files, then the parser would be able to recognize those external variables, let me know if you have any other questions about this, thanks.


Best Regards.
Charles.
Aaron Glover's profile image
Aaron Glover

Of Course! @Chao Han

Spot on. They are TYPE19 files so the filename is just the directory name.

Thanks. It works a treat!