Syntax highlighting for the AMPL modeling language.
This extension colors keywords, declarations, comments, strings, numbers, built-in functions and operators in AMPL files. It is a lightweight, highlighting-only extension: it does not run AMPL and does not require a local AMPL installation, so it also works in the browser version of VS Code (vscode.dev) on any device, including tablets.
Supported files
.mod, .dat, .run, .ampl
What is highlighted
- Objective and constraint keywords (
minimize,maximize,subject to) - Declarations (
set,param,var, ...) and modifiers (integer,binary, ...) - Commands (
model,data,solve,display,option, ...) - Control flow (
if,then,else,for,repeat, ...) - Aggregation and set operators (
sum,prod,forall,union, ...) - Built-in functions (
sqrt,log,exp, ...) - Comments (
#and/* ... */), strings, and numbers
Usage
Open any .mod, .dat, .run or .ampl file and the highlighting is applied
automatically.