Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Scoeerg opened this issue Aug 25, 2024 · 0 comments
Open
Labels
feature request Suggested features

Comments

@Scoeerg
Copy link

Scoeerg commented Aug 25, 2024

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

@Scoeerg Scoeerg added the feature request Suggested features label Aug 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Suggested features
Projects
None yet
Development

No branches or pull requests

1 participant