VSCode extension for inco, a compile-time assertion engine for Go. Provides syntax highlighting, diagnostics, commands, and snippets for @inco: directives.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
The official VS Code extension for inco — a compile-time assertion and contract engine for Go.
Write declarative contracts in your Go code using @inco: directives. The extension provides real-time feedback, code generation, and tooling integration.
Features
Syntax Highlighting
Directive Highlighting: @inco: and @if: directives are highlighted with distinct colors via TextMate grammar injection.
Action Colors: Keywords (@inco:, @if:) and actions (-panic, -return, -log, etc.) use different colors for readability.
Toggle: Quickly toggle highlighting on/off via the status bar or command palette.
Diagnostics
Inline Validation: Detects invalid directives, missing expressions, or unknown actions as you type.
Build Checks: Runs go build -overlay in the background to catch compile errors in directive expressions.
gopls Integration: Syncs overlay files with gopls via -overlay build flag for accurate editor intelligence.
Smart Completion
Action Suggestions: After typing a comma in a directive line, auto-complete suggests available actions: -panic, -return, -log, -continue, -break.
Snippet Support: Completions include snippet placeholders for action arguments (e.g., -return(val)).
Hover & Preview
Hover: Hover over any @inco: or @if: directive to see the exact guard code that will be generated.
Preview Diff: Open a side-by-side diff view comparing your source file with the generated overlay.
CodeLens
Displays the total directive count at the top of each .inco.go file.
Provides inline Gen, Audit, and Preview quick-action buttons.
Status Bar
Three buttons in the status bar:
Coverage %: Shows contract coverage ratio from inco audit. Click to run audit.