# Ilusm for VS Code

Official VS Code extension for the Ilusm programming language.

## Features

- **Syntax Highlighting** — Full support for Ilusm syntax
- **IntelliSense** — Autocomplete for stdlib functions and variables
- **Formatting** — Built-in code formatter
- **Snippets** — Quick code templates for common patterns
- **Themes** — Ilusm Dark and Ilusm Light color themes
- **File icons** — Optional **Ilusm (heart .ilu)** icon theme (extends Seti): pink heart for `.ilu` in the explorer. Command Palette → **Preferences: File Icon Theme** → **Ilusm (heart .ilu)**.
- **Commands** — Run files, show AST/tokens, REPL integration
- **Linter** — Real-time error detection

## Installation

1. Install from VS Code marketplace: search for "Ilusm" (when published under the extension publisher account)
2. Or install from VSIX: `code --install-extension ilusm-0.1.0.vsix`
3. **From the public download bundle** (folder already built with `out/` and production `node_modules/`):
   - **Visual Studio Code:** quit VS Code, copy this entire folder to  
     `~/.vscode/extensions/ilusm-lang.ilusm-0.1.0`  
     (Windows: `%USERPROFILE%\.vscode\extensions\ilusm-lang.ilusm-0.1.0`). Match the version in `package.json` if it differs.
   - **Other VS Code–based editors** (VSCodium, Cursor, etc.): use **their** user extensions directory with the **same** folder name `ilusm-lang.ilusm-0.1.0` (see that product’s docs for the path).
   - Restart the editor. Open a `.ilu` file — grammar and the **heart** language icon come from `syntaxes/` and `icons/ilu-heart.svg`.

Language runtime ships as **prebuilt stage-0** + **`lib/`** + **`ilusm`** (see **ilusm.dev**). Put **`ilusm` on `PATH`** or set **`ilusm.executablePath`** in settings to the full path of the launcher inside your install.

## Usage

### Running Ilusm Files

- `Ctrl+Shift+R` — Run current file
- `Ctrl+Shift+Enter` — Run selection
- Click play button in editor title bar

### Commands

| Command | Keybinding | Description |
|---------|------------|-------------|
| `Ilusm: Run File` | `Ctrl+Shift+R` | Run the current .ilu file |
| `Ilusm: Run Selection` | `Ctrl+Shift+Enter` | Run selected code |
| `Ilusm: Format File` | — | Format the current file |
| `Ilusm: Show AST` | — | Display AST for debugging |
| `Ilusm: Show Tokens` | — | Display token stream |
| `Ilusm: Start REPL` | — | Open Ilusm REPL in terminal |
| `Ilusm: Initialize Project` | — | Create new Ilusm project |

### Snippets

Type these prefixes and press `Tab`:

- `fn` — Function definition
- `if` / `ifb` — If expression/block
- `whl` — While loop
- `for` — For each loop
- `lam` — Lambda function
- `mat` — Pattern match
- `obj` — Object literal
- `lst` — List literal
- `pipe` — Pipe expression
- `try` — Try/catch
- `use` — Import module
- `prn` — Print statement
- `$` — Interpolated string

## Configuration

Settings (`Ctrl+,` then search "ilusm"):

| Setting | Default | Description |
|---------|---------|-------------|
| `ilusm.executablePath` | `ilusm` | Path to ilusm binary |
| `ilusm.enableLinter` | `true` | Enable linting |
| `ilusm.enableFormatter` | `true` | Enable formatting |
| `ilusm.trace.server` | `off` | LSP debug logging |

## Requirements

- VS Code 1.74.0 or higher
- Ilusm interpreter installed (`ilusm` in PATH)

## Development

```bash
cd vscode-extension
npm install
npm run compile
# Press F5 to launch extension host
```

## License

MIT
