99 lines
2.7 KiB
Markdown
99 lines
2.7 KiB
Markdown
# EFTL Language Extension for VS Code
|
|
|
|
Syntax highlighting and language support for **EFTL (ElixForms Template Language)**.
|
|
|
|
## Features
|
|
|
|
- **Syntax Highlighting** for all EFTL constructs
|
|
- **Code Snippets** for common patterns
|
|
- **Bracket Matching** for EFTL blocks
|
|
- **Code Folding** for block structures
|
|
|
|
## Supported Syntax
|
|
|
|
### Block Delimiters
|
|
- `[EFTL]...[/EFTL]` - Main EFTL block
|
|
- `[VAR name="..." type="..."]...[/VAR]` - Variable declarations
|
|
- `[IF]...[/IF]` - Conditionals
|
|
- `[WHILE]...[/WHILE]` - Loops
|
|
|
|
### Expressions
|
|
- `[% expression %]` - Execute expression
|
|
- `[%= expression %]` - Output expression value
|
|
|
|
### Data Tags
|
|
- `[TAG]GETVALUEBYTAG,TAG_NAME,REQUEST,IUQOID[/TAG]`
|
|
- `[TAG]SCHEMAID,schemaId,COL0001,IUQOID, , [/TAG]`
|
|
|
|
### Functions
|
|
- `[SPLIT regex="..."]...[/SPLIT]` - Split string
|
|
- `[TRIM]...[/TRIM]` - Trim whitespace
|
|
- `[VALUE_OF varname="..." index="..." /]` - Get array element
|
|
- `[SIZE_OF varname="..." /]` - Get array size
|
|
- `[CONTAINS varname="..."]...[/CONTAINS]` - Check containment
|
|
- `[FORMAT type="..." pattern="..."]...[/FORMAT]` - Format values
|
|
|
|
### Control Structures
|
|
- `[IF]`, `[CONDITION]`, `[THEN]`, `[ELSE]`, `[ELSE IF]`
|
|
- `[WHILE]`, `[DO]`
|
|
|
|
### Comments
|
|
- `[!-- comment --]`
|
|
|
|
## Installation
|
|
|
|
### From VSIX (Local)
|
|
|
|
1. Package the extension: `npx vsce package`
|
|
2. Install in VS Code: `code --install-extension eftl-language-0.1.0.vsix`
|
|
|
|
### Development Mode
|
|
|
|
1. Open this folder in VS Code
|
|
2. Press `F5` to launch Extension Development Host
|
|
3. Open any `.eftl` file to see syntax highlighting
|
|
|
|
## Snippets
|
|
|
|
| Prefix | Description |
|
|
|--------|-------------|
|
|
| `eftl` | EFTL block with header |
|
|
| `var` | Variable declaration |
|
|
| `vartag` | Variable from TAG |
|
|
| `varschema` | Variable from SCHEMAID |
|
|
| `if` | IF statement |
|
|
| `ifelse` | IF-ELSE statement |
|
|
| `while` | WHILE loop |
|
|
| `split` | Split function |
|
|
| `trim` | Trim function |
|
|
| `valueof` | VALUE_OF function |
|
|
| `sizeof` | SIZE_OF function |
|
|
| `contains` | CONTAINS function |
|
|
| `formatnum` | Format number |
|
|
| `tag` | GETVALUEBYTAG tag |
|
|
| `schema` | SCHEMAID tag |
|
|
| `out` | Output expression |
|
|
| `comment` | Comment block |
|
|
|
|
## Example
|
|
|
|
```eftl
|
|
[EFTL][HEADER name="trimDocument" value="true" type="boolean" /]
|
|
[VAR name="total" type="number"][% total = 0; %][/VAR]
|
|
[VAR name="items" type="iterable"][SPLIT regex=";"][TAG]GETVALUEBYTAG,ITEMS,REQUEST,IUQOID[/TAG][/SPLIT][/VAR]
|
|
|
|
[!-- Calculate total --]
|
|
[VAR name="count" type="number"][SIZE_OF varname="items" /][/VAR]
|
|
|
|
[IF]
|
|
[CONDITION][% count > 0 %][/CONDITION]
|
|
[THEN][%= count %] items found[/THEN]
|
|
[ELSE]No items[/ELSE]
|
|
[/IF]
|
|
[/EFTL]
|
|
```
|
|
|
|
## License
|
|
|
|
MIT
|