OPL Language Support
Professional VSCode support for OPL (One Piece Language), a lightweight programming language with pirate syntax, an AST interpreter, bytecode VM, diagnostics, and debugger tooling.
Quickstart
- Install the OPL runtime:
python -m pip install oplang
Install this VSCode extension.
Open any .opl file.
Run from a terminal:
opl run file.opl
- Debug from VSCode with the included
Run OPL launch configuration, or run:
opl debug file.opl
Features
- Syntax highlighting for
.opl files
- File icon support for
.opl files
- Bracket auto-closing for
{}, [], and ()
- Indentation support for functions, models, loops, and conditionals
- Snippets for common OPL patterns
- Autocomplete for functions, models, variables, methods, and standard library symbols
- Diagnostics for syntax and semantic issues
- Hover, go-to-definition, document symbols, and workspace symbols
- Editor title buttons for running and debugging the current
.opl file
- Explorer context menu actions for running and debugging
.opl files
- VSCode debugger integration with breakpoints, stepping, stack frames, and variables
File Extension
OPL uses one official source file extension:
.opl
Example
Pirate syntax:
dfruit add(a, b):
return a + b
bounty result = add(2, 3)
say result
Core syntax:
fn add(a, b) {
return a + b
}
let result = add(2, 3)
print(result)
Debugging
Use the default launch configuration:
{
"type": "opl",
"request": "launch",
"name": "Run OPL",
"program": "${file}"
}
Set breakpoints in .opl files, press F5, step through execution, and inspect variables in the VSCode debugger panels.
You can also use the editor title Debug button or right-click a .opl file in the Explorer and choose Debug OPL File.
Requirements
This extension expects the OPL runtime tools to be available through Python:
python -m pip install oplang
The runtime provides:
If VSCode cannot find your Python installation, set OPL_PYTHON to the Python executable that has oplang installed.
Snippets
dfruit creates a function
model creates a model with a spawn constructor
for creates a for-in loop
if creates an if statement
Extension Development
For maintainers working on the extension internals:
OPL_LSP_PATH can point to a local language server script.
OPL_DAP_PATH can point to a local debug adapter script.
- Publish a patch release only after reviewing the Marketplace README:
vsce publish patch