ORCH Language Support for VS Code
Full language support for the ORCH DSL (Domain Specific Language) with syntax highlighting, IntelliSense, linting, error diagnostics, and Python integration.
Features
🎨 Syntax Highlighting
- Full syntax highlighting for
.orch, .aeon, and .lib files
- Embedded Python syntax highlighting within
Func blocks
- Color-coded keywords, types, strings, numbers, and operators
🚀 IntelliSense & Autocomplete
- Keyword completion for all ORCH keywords (Include, Route, Task, Func, etc.)
- Type completion for built-in types (int, float, string, list, tuple, char)
- Snippet completion for common code patterns
- Variable completion based on document context
- Function completion for defined Tasks and Funcs
- Hover over keywords to see documentation
- Hover over variables to see type and value information
- Hover over functions to see their type and description
🎯 Go to Definition
- Jump to Task and Func definitions
- Navigate to variable declarations
- Find agent file references
📋 Document Symbols
- View all Tasks, Funcs, variables, and blocks in the document outline
- Quick navigation to any symbol
⚠️ Linting & Error Diagnostics
- Real-time error detection with squiggly underlines
- Brace matching validation for {}, [], ()
- Syntax error detection for malformed statements
- Semantic analysis for undefined references
- Python integration - lint Python code within Func blocks using pylint, flake8, or mypy
📝 Code Snippets
- Pre-built snippets for common ORCH constructs
- Quick insertion of Route, Task, Func, IF-ELSE blocks
- Customizable snippets
Supported File Types
.orch - Main ORCH orchestration files
.aeon - Agent definition files
.lib - Library files with shared functions
Configuration
The extension provides the following settings:
{
"orch.enableLinting": true,
"orch.pythonLinter": "pylint",
"orch.trace.server": "off"
}
Settings Details
orch.enableLinting: Enable/disable linting for ORCH files (default: true)
orch.pythonLinter: Choose Python linter for Func blocks - options: pylint, flake8, mypy (default: pylint)
orch.trace.server: Trace communication with language server - options: off, messages, verbose (default: off)
Python Integration
The extension seamlessly integrates with Python linters to validate code within Func blocks:
Func calculate_sum {
# This Python code will be linted by your chosen linter
result = a + b
return result
}
Requirements
To use Python linting, you must have one of the following installed:
- pylint:
pip install pylint
- flake8:
pip install flake8
- mypy:
pip install mypy
Language Features
Keywords
All ORCH keywords are supported with full IntelliSense:
- Control Flow:
IF, ELSE, CALL
- Definitions:
Include, Route, Private, Public, Task, Func, return
- Events:
on_start, on_end
- Types:
int, float, char, string, list, tuple
- Logical:
AND, OR, true, false
Operators
All operators are recognized and highlighted:
- Comparison:
<, >, <=, >=, ==, !=
- Arithmetic:
+, -, *, /
- Assignment:
=
Line comments start with #:
# This is a comment
int x = 10 # This is also a comment
Examples
Basic Orchfile (.orch)
# Include agents
Include agent1
Include agent2
# Define variables
int max_count = 100
string message = "Hello ORCH"
# Define routing
Route {
count < max_count : agent1
count >= max_count : agent2
on_start : agent1
on_end : agent2
}
Agent File (.aeon)
# Private variables
Private {
int counter = 0
Public string name = "MyAgent"
}
# Define tasks
Task initialize {
counter = 0
}
Task process {
IF counter < 10 {
counter = counter + 1
} ELSE {
counter = 0
}
}
# Python function
Func calculate {
# Python code here
result = counter * 2
return result
}
# Routing
Route {
counter == 0 : initialize
counter > 0 : process
on_start : initialize
}
Library File (.lib)
# Shared functions
Func add {
# Python function
result = a + b
return result
}
Func multiply {
# Python function
result = a * b
return result
}
Commands
The extension provides the following commands:
orch.restartServer: Restart the ORCH language server
Development
Building the Extension
npm install
npm run compile
Running in Development
- Open this extension in VS Code
- Press F5 to open a new VS Code window with the extension loaded
- Open a folder containing
.orch, .aeon, or .lib files
Project Structure
orch-extension/
├── src/
│ ├── extension.ts # Main extension entry point
│ ├── providers/ # Language feature providers
│ │ ├── completionProvider.ts # Autocomplete
│ │ ├── diagnosticsProvider.ts # Linting & errors
│ │ ├── hoverProvider.ts # Hover information
│ │ ├── definitionProvider.ts # Go to definition
│ │ └── documentSymbolProvider.ts # Document outline
│ ├── utils/
│ │ └── pythonLinter.ts # Python integration
│ └── server/
│ └── server.ts # Language server
├── syntaxes/ # TextMate grammar files
├── snippets/ # Code snippets
├── language-configuration.json # Language configuration
└── package.json # Extension manifest
Troubleshooting
Python Linting Not Working
- Ensure you have a Python linter installed:
pip install pylint (or flake8, mypy)
- Check that the linter is in your PATH
- Verify the
orch.pythonLinter setting matches your installed linter
Language Server Not Starting
- Check the Output panel (View > Output > ORCH Language Server)
- Enable tracing: Set
orch.trace.server to verbose
- Try restarting the server: Command Palette > "ORCH: Restart Server"
Syntax Highlighting Not Working
- Ensure file extensions are correct:
.orch, .aeon, or .lib
- Check that the language mode is set correctly (bottom-right of VS Code)
- Reload the window: Command Palette > "Developer: Reload Window"
License
MIT License - see LICENSE file for details
Contributing
Contributions are welcome! Please feel free to submit issues and pull requests.
Release Notes
1.0.0
- Initial release
- Full syntax highlighting for .orch, .aeon, .lib files
- IntelliSense with autocomplete
- Error diagnostics and squiggles
- Python integration with pylint/flake8/mypy
- Hover information and go to definition
- Document symbols and outline
- Code snippets
| |