Skip to content

athackst/vscode-ament-task-provider

Repository files navigation

ROS 2 Ament Task Provider

Provides problem matchers for use with ROS 2 projects using the ament build system.

Installation

You can grab this from the Visual Studio Code Marketplace or simply search for "ament task provider" in the extensions tab of VS Code.

Features

Provides the following problem matchers:

  • $ament-cpplint — adds errors and warnings reported by ament_cpplint
  • $ament-cppcheck — adds errors and warnings reported by ament_cppcheck
  • $ament-lint-cmake — adds errors and warnings reported by ament_lint_cmake
  • $ament-flake8 — adds errors and warnings reported by ament_flake8
  • $ament-mypy — adds errors and warnings reported by ament_mypy
  • $ament-pep257 — adds errors and warnings reported by ament_pep257
  • $ament-xmllint — adds errors and warnings reported by ament_xmllint

Usage

demo

Prerequiesite You must have the ament linters installed on your system for the appropriate linter to run.

sudo apt-get install ros-$ROS_DISTRO-ament-lint

From the task panel select ament and then the linter you'd like to run.

That's it!

tasks.json

You can also save the configuration within your workspace like so:

.vscode/tasks.json

{
  "version": "2.0.0",
  "tasks": [
    {
      "type": "ament",
      "task": "cppcheck", // The name of the problem matcher
      "path": "src/", // The path to your source files
      "commandOptions": "", // Optional additional command line options
      "envSetup": "" // Optional setup to run before liner (ex: source /opt/ros/humble/setup.bash )
      "problemMatcher": [
        "$ament_cppcheck" // the corresponding problem matcher - can be used independently
      ],
      "label": "ament: cppcheck"
    }
  ]
}

Settings

There is one optional setting that will set the setup script to run before the all of the linters in the workspace. This can be overwritten in the tasks.json file.

ament-task-provider-settings

Contributing

Want to contribute to this plugin! See Contributing for development details.

License

This software is licensed under Apache 2.0.

Attributions

Leaf icons created by Freepik - Flaticon