Oite Language Support for VS Code
A VS Code extension providing language support for Oite (.ot) files. This extension provides:
- Diagnostics: Real-time error checking using the Oite compiler
- Formatting: Automatic code formatting for
.ot files
- Linting: Borrow checker and lifetime error detection
- Syntax Highlighting: Full syntax support for Oite files
Features
Error Checking
The extension automatically checks your .ot files for:
- Parsing errors
- Borrow checker violations
- Lifetime errors
- Type errors
Errors are displayed inline with red squiggles.
Format your Oite code automatically:
- Format Document:
Shift+Alt+F (or right-click > Format Document)
- Format on Save: Enable in settings (
oite.formatOnSave)
The formatter handles:
- Indentation
- Spacing around operators
- Brace placement
- Line breaks
Configuration
You can configure the extension in VS Code settings:
{
"oite.compilerPath": "", // Path to oitec binary (auto-detected if empty)
"oite.checkOnSave": true, // Check for errors when saving
"oite.formatOnSave": false, // Format code when saving
"oite.enableLinting": true // Enable linting diagnostics
}
Installation
Build the Oite compiler:
cd /path/to/oite
cargo build --release
Install extension dependencies:
cd /path/to/vscode-oite
npm install
Compile the extension:
npm run compile
Open the extension folder in VS Code and press F5 to launch a new Extension Development Host window.
How It Works
The extension uses the Language Server Protocol (LSP) to communicate with the Oite compiler:
LSP Client (src/extension.ts): Launches the Oite compiler in LSP mode and connects via the VS Code Language Client.
Compiler Integration: The Oite compiler (oitec) provides an LSP server:
oitec <unroll-main> lsp
This serves diagnostics, formatting, hover, and go-to-definition features.
Development
Building
npm install
npm run compile
Debugging
- Open the extension folder in VS Code
- Press
F5 to launch Extension Development Host
- Open a
.ot file in the new window
- Set breakpoints in
src/extension.ts
Testing
The extension will automatically:
- Check files when opened
- Re-check on save (if
checkOnSave is enabled)
- Format on request or save (if
formatOnSave is enabled)
Requirements
- Node.js 16+
- VS Code 1.108.0+
- The Oite compiler (
oitec) built and available in the workspace or system PATH
Known Limitations
- Error location detection is heuristic-based and may not always be precise
- Formatting is basic and may not handle all edge cases
- The compiler must be built before the extension can provide diagnostics
Contributing
Contributions are welcome! Please feel free to submit issues or pull requests.
License
See LICENSE for details.