Editor Integration
InfraGuard provides editor integration through a built-in Language Server Protocol (LSP) server and a VS Code extension, enabling intelligent editing support for ROS templates.
VS Code Extension
Installation
Install the InfraGuard extension from the VS Code Marketplace, or search for "InfraGuard" in the VS Code Extensions panel.
Features
Auto-Completion
Context-aware completions across the entire template structure:
- Resource types — All ALIYUN::* resource type identifiers
- Properties — Resource properties with type information, required properties prioritized
- Intrinsic functions —
Fn::Join,Fn::Sub,Fn::Select, and more - Ref/GetAtt targets — References to parameters, resources, and their attributes
- Parameter definitions — Type, Default, AllowedValues, and other parameter properties
- Top-level sections — ROSTemplateFormatVersion, Parameters, Resources, Outputs, etc.
When you type a resource type, a Properties block with all required keys is auto-inserted.
Real-Time Diagnostics
Validates your template as you type:
- Missing or invalid
ROSTemplateFormatVersion - Unknown resource types
- Missing required properties
- Type mismatches for property values
- Invalid parameter definitions
- Duplicate YAML keys
- Unknown keys with "Did you mean?" suggestions
Hover Documentation
Hover over elements to see contextual documentation:
- Resource types — Description and link to official docs
- Properties — Type, constraints, whether required or optional, update behavior
- Intrinsic functions — Syntax and usage examples
Go to Definition
Jump to definitions from references:
- Ref targets — Jump from
!ReforRefto the parameter or resource definition - GetAtt targets — Jump from
Fn::GetAttto the resource definition - Resource references — Navigate to resource definitions from property references
- AssociationPropertyMetadata — Jump from
${Name}placeholders in metadata to parameter definitions
Use Ctrl+Click (or Cmd+Click on macOS) or press F12 on a reference to jump to its definition.
Syntax Highlighting
Enhanced syntax highlighting for ROS-specific elements:
!Ref,Fn::Join, and other intrinsic functionsALIYUN::*::*resource type identifiers
Supported File Types
| Pattern | Detection |
|---|---|
*.ros.yaml / *.ros.yml | Automatically recognized as ROS templates |
*.ros.json | Automatically recognized as ROS templates |
*.yaml / *.json | Detected via ROSTemplateFormatVersion in content |
Commands
| Command | Description |
|---|---|
| InfraGuard: Update ROS Schema | Fetch the latest resource type schema from ROS API |
Updating ROS Schema
The extension ships with a built-in schema for ROS resource types. To update it with the latest resource type definitions:
- Open the Command Palette (
Ctrl+Shift+P/Cmd+Shift+P) - Run InfraGuard: Update ROS Schema
This requires Alibaba Cloud credentials to be configured. See infraguard schema update for credential setup.
LSP Server
The LSP server can be integrated with any editor that supports the Language Server Protocol.
Starting the Server
infraguard lsp
The server communicates via stdio (standard input/output).
Editor Configuration
For editors other than VS Code, configure the LSP client to:
- Start the server with
infraguard lsp - Use stdio as the transport
- Associate with YAML and JSON file types
See infraguard lsp for more details.