Effect Sugar VSCode Extension
Provides syntax highlighting and TypeScript error suppression for Effect-TS gen blocks.
Features
- Syntax highlighting for
gen { } blocks and <- operator
- TypeScript error suppression inside gen blocks (via TS plugin)
- Code actions explaining suppressed errors
Installation
Development Installation
TypeScript Plugin Setup
To enable error suppression, add the TypeScript plugin to your tsconfig.json:
{
"compilerOptions": {
"plugins": [
{ "name": "effect-sugar-ts-plugin" }
]
}
}
Then tell VSCode to use the workspace TypeScript version:
- Open Command Palette (
Cmd+Shift+P)
- Run "TypeScript: Select TypeScript Version"
- Choose "Use Workspace Version"
Usage
Files with .gen.ts extension will automatically use the Effect Sugar language mode.
For regular .ts files, the syntax injection grammar will highlight gen blocks.
Example
const program = gen {
user <- getUser(id)
profile <- getProfile(user.id)
return { user, profile }
}
Configuration
effectSugar.suppressDiagnostics | true | Suppress TypeScript diagnostics inside gen blocks |
How It Works
- TextMate Grammar: Provides syntax highlighting for
gen, <-, and variable bindings
- Injection Grammar: Highlights gen blocks in regular
.ts/.tsx files
- TypeScript Plugin: Hooks into the language service to filter diagnostics
Known Limitations
- Full type inference inside gen blocks requires the build transformation to run
- Hover information shows raw syntax, not inferred types
- Go-to-definition for bound variables doesn't work inside gen blocks
Development
npm install
npm run compile
npm run watch
npm run package
Roadmap