VSCode with RobotCode while debugging ignores launch.json setting

Context

I’m working on a Robot Framework project using VSCode and the robotcode extension (robotcode-dbiel). In production, we have one git repo for the framework, and one git repo for any test related assets maintained separately.

Therefore when developing / debugging my folder structure looks like this:

git/
├── .vscode/
│   └── launch.json
├── FW/
│   └── Python libraries, resource files
├── FW-TEST-RESOURCES/
│   └── test_cases
│   └── input_variables.yaml   <--- Paths of configuration files relative to working dir folder which will be loaded in the various python scripts

When I CD to git, and run robot via CLI it works.

robot FW-TEST-RESOURCES/test_cases/test.robot

But when I set up my launch.json for debugging,

    {
       "name": "Robotcode: Run Test with Root CWD",
       "type": "robotcode",
       "request": "launch",
       "target": "${file}",         // Runs the currently active file
       "cwd": "${workspaceFolder}", // Forces CWD to the root (your git folder)
       "args": [],
    }

Problem

Even though I’ve explicitly set "cwd": "${workspaceFolder}", the debugger still sets the current working directory to the base folder of the git repo of the test file (e.g., FW-TEST-RESOURCES/), not the root git/ folder.

This breaks my logic because:

  • I load input_variables.yaml (stored in FW-TEST-RESOURCES/), which contains relative paths from the git folder pointing at paths inside FW folder.

  • My Python code in FW/ expects to resolve these paths relative to the root project folder (git/), since cwd is wrong, when I prepend Path.cwd() to the relative path, I get errors like:

    FileNotFoundError: Configuration file 'git/FW-TEST-RESOURCES/FW/configs/config.yaml' not found!

    When the expected path would be git/FW/configs/config.yaml

I have also tried hardcoding the cwd in launch.json to the absolute path of the git folder, with same result.

How can I make VSCode and robotcode use the actual workspace root (git/) as the working directory during debug runs? So it works as when I run it from CLI with robot

How did you checkout/clone/pull the repository to your hard disk? Are you using git submodules? Where are the .git folders located?


RobotCode attempts to detect a project’s root folder based on several criteria, which is independent of the workspace opened in VSCode. The detection prioritizes what it finds first:

  1. A robot.toml file
  2. A pyproject.toml file
  3. Version control markers (like .git or .hg folders)

If none of these are found, the current folder becomes the project folder. Note that the .git folder is where git stores repository information.


I suspect you have .git folders in both your FW-TEST-RESOURCES folder and your git folder. This creates a conflict where:

  • RobotCode Runner uses FW-TEST-RESOURCES as the root folder for test execution
  • The language server component uses the git folder’s .git directory (since that’s what’s opened in VSCode)

Two possible solutions:

Option 1: Open FW-TEST-RESOURCES directly in VSCode instead of the git folder. However, this means you won’t have access to your framework files in the workspace.

Option 2: Create or modify a launch.json configuration:

If you already have a launch.json, remove all RobotCode-related configurations, then add:

{
    "name": "RobotCode: Default",
    "type": "robotcode",
    "request": "launch",
    "presentation": {
        "hidden": true
    },
    "purpose": "default",
    "robotCodeArgs": [
        "--no-vcs"
    ]
}
  • The "purpose": "default" setting makes this the default configuration for running tests with RobotCode (can be extended/overridden by other configs)
  • The --no-vcs flag disables .git directory detection for the RobotCode runner (this doesn’t affect the language server or discovery features, which use VSCode’s workspaceFolder)

Additional recommendation:

After implementing the above changes, consider creating a robot.toml configuration file in your project root:

paths = ["FW-TEST-RESOURCES/test_cases"]

Thank you! This helped solve my problem!

Now I have another issue which is that the extension seems to not identify the paths correctly in the UI, not making links clickable, although the tests run fine. But I will investigate some more and create another thread if needed. Thanks!