Cloudscript is a new Infrastructure-as-Code (IaC) language inspired by HCL. This Visual Studio Code extension provides syntax highlighting, language configuration, and helpful snippets for .cloud files. The language also supports custom type definitions to help modularize code and validate resources against typed schemas.
- Syntax Highlighting: Highlights keywords such as
providers,service,infrastructure,configuration,containers, anddeployment. - Comments and Bracket Support: Supports single-line (
#). Includes basic bracket pairing and indentation rules. - Snippets: Provides a default template snippet for new
.cloudfiles. When you open or create a.cloudfile, you can quickly insert a scaffold withproviders {}, and a base service block. - Custom Types Integration (Planned / In Progress): Prepare for more advanced features like validation of resources against custom types. For example:
type DatabaseConfig {
engine: "postgres" | "mysql" | "sqlite"
version: string?
storage: number = 20
}
resource "aws_db_instance" "default" {
type = DatabaseConfig
engine = "postgres"
version = "12.3"
}Once integrated with a language server, this would ensure missing fields are caught and defaults are applied.
- Visual Studio Code (latest version recommended)
- Node.js and npm (if you plan on developing and testing the extension)
- Basic familiarity with IaC files and HashiCorp Configuration Language (HCL) syntax
- Run
npm installandnpm run compileif you have a build step. - Press
F5in VS Code to launch the extension in a new Extension Development Host window. - Once tested, you can package it using
vsce package(if you have vsce installed), then install the .vsix via:- View > Extensions in VS Code
- Click on the
...menu and select "Install from VSIX..." - Select the generated .vsix file to install.
- Open the Extensions view in VS Code (
Ctrl+Shift+XorCmd+Shift+Xon macOS). - Search for "Cloudscript" and click Install.
When you open a file ending in .cloud, the extension will automatically apply Cloudscript syntax highlighting.
Create a new .cloud file, then type cloud-template and select the snippet from the suggestion list to insert a basic scaffold:
type CustomType {}
providers {}
service "name" {
provider = ""
infrastructure {}
configuration {}
containers {}
deployment {}
}If you've enabled the snippet insertion via the extension.js logic, simply creating a new .cloud file may automatically insert this template if the file is empty.