Visual Studio Code extension

The VSCode editor

Microsoft® Visual Studio Code is a powerfull source code editor available on various platforms.

After installing the VSCode extension for Genero BDL, code completion, syntax highlighting, goto definition, code formatting and debugging is possible in VSCode for Genero .4gl and .per sources.

Installing VSCode

First you need to download and install Microsoft Visual Studio Code.

This documentation page does not explain how to use VSCode, you need to be familiar with this editor.

Check https://code.visualstudio.com/ for more details.

Installing Genero BDL extension into VSCode

In order to install the Genero BDL extension in your VSCode environment, execute the following command:

$ code --install-extension $FGLDIR/lib/genero-fgl-*.vsix

Alternatively, you can start VSCode, and go to the Extensions section, then load the Genero BDL .vsix extension file from FGLDIR/lib.

When upgrading the version of Genero BDL, re-install the VSCode extension file to get bug fixes and new features of this plugin.

When VSCode is started, you should see the Genero extension in the Extensions section.

Select the Genero extension and read the description.

Configuring VSCode for a Genero BDL project

Perform the following steps to setup VSCode for Genero BDL:
  1. Start VSCode
  2. Configure the editor to exclude .42? files:
    • Open VSCode settings
    • Select the "User" tab for global settings
    • "Text Editor" → "Files: Exclude"
    • Add .42? to the exclude list
  3. Configure the debugger to get inline values:
    • Open VSCode settings
    • Select the "User" tab for global settings
    • Select "Features" → "Debug" → "Inline Values" → on
  4. Open a folder with Genero BDL sources. The editor will consider this directory as root dir for your project, and configuring VSCode will automatically create a .vscode directory with configuration files.
  5. Define a build task for Genero programs for this folder:
    • Select "Terminal" → "Configure Default Build Task"
    • "Create task.json file from template" → "Others"
    • Define the build task with attribute "problemMatcher": "$fglcomp". The "command" attribute must defined the build command, like "fglcomp -r --make -M *.4gl" to build all .4gl sources, or "make" to use a makefile. For example:
      {
        "version": "2.0.0",
        "tasks": [
          {
            "label": "fglcomp-all-4gl",
            "type": "shell",
            "command": "fglcomp -r --make -M *.4gl",
            "problemMatcher": "$fglcomp",
            "options": {
              "cwd": "${workspaceFolder}"
            },
            "group": {
              "kind": "build",
            }
          }
        ]
      }
      See Genero extension description for details.
  6. Define launch tasks for Genero programs:
    • Click on "Run and Debug" arrow on the left.
    • Click the "create a launch.json file" link
    • Select "Debug with fgldb-dap"
    • With launch.json file opened, click on the "Add Configuration..." button
    • Select "GeneroFgl Debug: Attach"
    • The launch task entries in launch.json should then look like this:
      {
          "version": "0.2.0",
          "configurations": [
              {
                  "type": "fgldb-dap",
                  "request": "attach",
                  "name": "(4gl) Attach",
                  "processId": "${command:pickProcess}"
              },
              {
                  "type": "fgldb-dap",
                  "request": "launch",
                  "name": "(4gl) Launch",
                  "program": "${workspaceFolder}/${fileBasenameNoExtension}",
                  "args": ["interact"],
                  "externalConsole": false,
                  "cwd": "${workspaceFolder}"
              }
          ]
      }
  7. Select "Terminal" → "Run Build Task..."
  8. Click on "Run and Debug" arrow on the left.
  9. Start debugging (with F5)