Visual Studio Code language support for AiLang .aos, .aiproj, and AiSVG .aisvg files.
This extension is intentionally a thin editor adapter:
- syntax highlighting through TextMate grammars
- bracket/comment/editor configuration
- Explorer file nesting for AiSVG code-behind files
- snippets for common AiLang and AiSVG node forms
- future commands that call the AiLang CLI for check/format/run
It must not define AiLang or AiSVG semantics. Semantic authority remains in AiLang/AiVectra and the normative specs in the main repositories:
SPEC/IL.mdSPEC/EVAL.mdSPEC/VALIDATION.mdSPEC/AISVG.md
Features
Current scaffold:
.aosand.aiprojfile association.aisvgfile association for AiSVG view documents*.aisvg.aoscode-behind files remain AiLang/AOS files because they end in.aos- VS Code Explorer nests
*.aisvg.aosunder the matching*.aisvgfile - highlighting for core AiLang node kinds from the current IL spec
- highlighting for common AiSVG node kinds such as
AiSVG,Group,Path,Rect,Circle,LinearGradient, andStop - highlighting for XML-like SVG tags and attributes in
.aisvgfiles - nested AiLang/AOS highlighting inside
{{ ... }}regions in AiSVG files - highlighting for common attributes such as
name,value,target,path,package,sdk,params,async,fill,stroke,viewBox,d,transform, and gradient stop attributes - highlighting for strings, numbers, booleans, null, comments, dotted syscall/call targets, SVG dimensions, and color literals
- language configuration for brackets, comments, surrounding pairs, and folding markers
- snippets for
Program,Import,Export,Let,Fn,Call,If,Return,Project,Include, plus common AiSVG document/node forms
AiSVG file pairing
AiSVG uses a view/code-behind pairing:
MainView.aisvg
└── MainView.aisvg.aos
MainView.aisvgis the AiSVG view file.MainView.aisvg.aosis the AiLang/AOS code-behind file for that view.- The VS Code Explorer should display the code-behind file nested under the matching view file.
- The code-behind file is not a separate AiSVG document type; it is AiLang/AOS attached to an AiSVG view.
The extension contributes this default file nesting rule:
{
"explorer.fileNesting.patterns": {
"*.aisvg": "${capture}.aisvg.aos"
}
}
AiSVG embedded expressions
AiSVG files may embed AiLang/AOS expressions using {{ ... }}. The extension delegates those embedded regions to the existing AiLang TextMate grammar for editor highlighting only.
Example:
AiSVG(width=800 height=600 viewBox="0 0 800 600") {
Defs {
LinearGradient(id="sky" x1="0%" y1="0%" x2="0%" y2="100%") {
Stop(offset="0%" stopColor="#8fd3ff")
Stop(offset="100%" stopColor="#ffffff")
}
}
Rect(x=0 y=0 width=800 height=600 fill="url(#sky)")
Text(x=40 y=80 fontSize=32 fill="#1f2937") {
{{ Call(target=weather.currentSummary) }}
}
}
Architecture rule
The extension may recognize tokens for editor presentation, but validation, formatting, evaluation, and diagnostics must come from the AiLang toolchain.
Good future behavior:
VS Code command -> ailang check -> Problems panel
VS Code command -> ailang fmt -> replace document text
VS Code command -> ailang run -> terminal output
Bad behavior:
VS Code extension implements semantic validation itself
VS Code extension decides module resolution rules
VS Code extension formats using separate semantic rules
Development
Install dependencies:
npm install
Package locally:
npx vsce package
Run the extension from VS Code:
- Open this repository in VS Code.
- Press
F5to launch an Extension Development Host. - Open a
.aosor.aisvgfile.
File types
.aos— AiLang source files.aiproj— AiLang project manifest files.aisvg— AiSVG view documents.aisvg.aos— AiLang/AOS code-behind files for matching.aisvgview documents
License
MIT