ros2_awesome provides schema definitions for ROS 2 launch files in both YAML and XML formats.
These schemas enable:
in editors such as VS Code.
https://ok-tmhr.github.io/ros2_awesome/schema/launch.yaml
https://ok-tmhr.github.io/ros2_awesome/schema/launch_ros.xsd
You can explicitly specify the schema at the top of your .launch.yaml file:
# yaml-language-server: $schema=https://ok-tmhr.github.io/ros2_awesome/schema/launch.yaml
launch:
- arg:
name: example
This method is portable and works in any environment.
See the sample/ directory for complete examples.
Add the schema reference inside the <launch> tag:
<launch
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://ok-tmhr.github.io/ros2_awesome/schema/launch_ros.xsd">
<arg name="example"/>
</launch>
If you prefer not to write $schema in every YAML file,
VS Code can automatically apply the schema based on file patterns.
Open Settings (JSON) and add:
{
"yaml.schemas": {
"https://ok-tmhr.github.io/ros2_awesome/schema/launch.yaml": [
"*.launch.yaml",
"*.launch.yml"
]
}
}
Now all launch YAML files will automatically use the schema.
This repository includes a snippet extension:
launch_substitution.json
It provides auto-completion for ROS 2 substitution syntax:
$(var name)
$(env FOO)
$(not value)
$(eval ...)
ROS 2 substitutions are not limited to launch files. They also work inside parameter YAML files when loaded through a launch file.
ctrl + shift + p)VS Code treats snippet JSON files as installable local extensions.
$ triggers substitution snippetsnot triggers $(not …)The sample/ directory contains:
$schemaThese samples are the quickest way to understand how the schema behaves.
Issues and PRs are welcome. Schema improvements, missing elements, or substitution patterns can be added incrementally.