Skip to content

Instantly share code, notes, and snippets.

@calumroy
Last active October 7, 2019 14:19
Show Gist options
  • Save calumroy/44934dd640f0da1658072f697f43e007 to your computer and use it in GitHub Desktop.
Save calumroy/44934dd640f0da1658072f697f43e007 to your computer and use it in GitHub Desktop.
Useful snippets about vscode

Tasks task.json

Example task.json

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "_runner": "terminal",
    "tasks": [
        {
            "label": "echo",
            "type": "shell",
            "command": "colcon",
            "args": [
                "build",
                "--cmake-args",
                " '-DCMAKE_BUILD_TYPE=Debug'"
            ],
            "problemMatcher": [],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "dependsOn": [
                "source_ros_dashing"
              ]
            // "options": {
            //     "shell": {
            //         "executable": "/bin/bash",
            //         "args": [
            //         ]
            //     }
            // }
        },
        {
            "label": "source_ros_dashing",
            "type": "shell",
            "command": "source",
            "args": [
                "/opt/ros/dashing/setup.bash"
            ],
            "problemMatcher": [],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}

Debugging launch.json

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/build/blackbox/blackbox_main",
            "args": ["__params:=${workspaceFolder}/param/blackbox.param.yaml"],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ]
        }
    ]
}

Library paths c_cpp-properties.json


    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**",
                "/opt/ros/dashing/include",
                "/usr/local/include/"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/gcc",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "clang-x64"
        }
    ],
    "version": 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment