Skip to content

04 OpenEdgeProject

Gilles Querret edited this page Sep 11, 2024 · 3 revisions
  1. The ABL plugin for VS Code requires a configuration file; it is not intended to replace the procedure editor where you can open files and compile them directly. Instead, the ABL plugin for VS Code functions similarly to Progress Developer Studio, where the .project and .propath files are essential for any operations.

    In VS Code, the configuration file is named openedge-project.json and is always located in the root directory of your project. As a JSON file, it is good practice to store it in your code repository.

    Open the openedge-project.json file in the root directory of your project. The JSON file in the project is not valid, you can identify this in two ways:

    • The status bar shows "No project found".

      No Project Found

    • The language server output displays an error.

      Language Server Error

  2. Edit openedge-project.json, then use code completion to add the missing attributes, or copy and paste the following lines:

    {
      "name": "Chapter3",
      "version": "1.0",
      "oeversion": "12.8",
      "graphicalMode": false,
      "charset": "utf-8",
      "buildPath": [],
      "dbConnections": []
    }

    Next, restart the language server by either restarting VS Code or using the command "ABL: Restart Language Server" (you can access commands with Ctrl + Shift + P). With the correct configuration, the language server should start without issues. If any errors occur, you can check for error messages in several locations, typically reported in the .builder directory:

    • The builder.lock file is managed by the language server. If you attempt to open multiple instances of VS Code within the same project, the language server will report an error indicating that this file is locked.
    • clientlog0.log and stdout0.log: the standard output of the AVM is redirected to stdout0.log, and the AVM is started with the -clientlog clientlog0.log option. These log files contain valuable information that can help with troubleshooting and understanding the compilation process.

  3. You can now open src/test1.p in VS Code and add code to the procedure. After saving the file, you might notice that syntax errors are not reported in VS Code. This happens because the language server monitors source directories for file changes, and no source directories have been defined in the configuration file. To resolve this, add a source directory in openedge-project.json:

    "buildPath": [
      {
        "path": "src",
        "type": "source",
        "build": "target/build"
      }
    ]

    After making the modifications, restart the language server. You should see in the output that the source entry has been successfully added:

    The language server output will indicate that files are being compiled during startup:

    Procedures and classes are compiled at startup if there is no rcode in the build directory. There is no "Check syntax" button; use Ctrl + S to save the file, and the language server will compile it in the background. Compilation errors will be underlined in red within the file. Additionally, the Problems view will display any compilation errors.

    You can filter the "Problems" view to show issues only for the active file:


Next chapter

Clone this wiki locally