Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.
This repository was archived by the owner on Sep 2, 2025. It is now read-only.

Add relative paths .vscode's c_cpp_properties.json and settings.json ... #1297

@Scoeerg

Description

@Scoeerg

What's the feature:

Currently the extension generates e.g. c_cpp_properties.json with with absolute paths /home/user/ros_ws/... which can be substituted with ${workspaceFolder}.

{
  "configurations": [
    {
      "browse": {
        "databaseFilename": "${default}",
        "limitSymbolsToIncludedHeaders": false
      },
      "includePath": [
        "/opt/ros/humble/include/**",
        "/home/user/ros_ws/src/cpp_python_package/include/**",
        "/usr/include/**"
      ],
      "name": "ROS",
      "intelliSenseMode": "gcc-x64",
      "compilerPath": "/usr/bin/gcc",
      "cStandard": "gnu11",
      "cppStandard": "c++14"
    }
  ],
  "version": 4
}

and settings.json:

{
    "ros.distro": "humble",
    "python.autoComplete.extraPaths": [
        "/home/user/ros_ws//install/cpp_python_package/local/lib/python3.10/dist-packages",
        "/opt/ros/humble/lib/python3.10/site-packages",
        "/opt/ros/humble/local/lib/python3.10/dist-packages"
    ],
    "python.analysis.extraPaths": [
        "/home/user/ros_ws//install/cpp_python_package/local/lib/python3.10/dist-packages",
        "/opt/ros/humble/lib/python3.10/site-packages",
        "/opt/ros/humble/local/lib/python3.10/dist-packages"
    ],
    "files.associations": {
        "functional": "cpp"
    },
    "cmake.sourceDirectory": "/home/user/ros_ws/ros_ws/src/cpp_python_package"
}

This enables path-independent settings for any user cloning the workspace-repository.
There would be no need to re-generate the settings or any manual editing.

Why is it useful?
It would make exchanging an entire workspace between developers easy, where any developer uses the same configuration for IntelliSense, debugging, building and running - especially with large and complex setups.

My setups usually have the workspace as a parent git-repo where packages are git-submodules. I.e. it is meaningful to transfer .vscode of a workspace between developers.
Currently, I manually change the paths and push them to the workspace git-repos.

Related:

#164

In the file launch.json it should be possible to use the variable ${workspaceFolder} in the ros-launch target field.
launch.json

#129

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions