MESA Inlist — VS Code extension
Syntax highlighting, validation, hover documentation and autocomplete for
MESA stellar-evolution inlist files
(inlist, inlist_project, project_inlist, inlist_pgstar, …). Built and
verified against MESA 26.4.1.
The extension turns MESA inlists from plain text into a checked, color-coded
configuration language:
- Valid controls are highlighted with theme-consistent colors (control
names, namelist sections, strings, numbers, logicals, comments).
- Invalid controls are marked red — unknown control names, controls in the
wrong namelist section, and values of the wrong type all get an error squiggle
plus a red foreground on the offending name.
- Type checking ("semi-compiler"): every control knows whether it expects a
logical, integer, real or string, and whether it is an array. Wrong
types are flagged.
- Value checking: string controls that document their allowed options
(e.g.
MLT_option, energy_eqn_option, atm_option, overshoot_scheme)
warn when you use an unknown value.
- Hover documentation: hover a control or value to see its type, default
value, allowed options and the MESA documentation.
- Autocomplete: press
Ctrl+Space inside a namelist to list all controls of
that section, or after = to complete logicals and documented string options.
What is recognised as an inlist?
Any file whose name contains inlist (for example inlist, inlist_project,
project_inlist, inlist_pgstar, inlist_zams), plus any *.inlist file.
To switch a file manually, run MESA Inlist: Treat current file as a MESA inlist.
Features in detail
Syntax highlighting
| Element |
Example |
| Namelist section |
&controls / &star_job / &pgstar … |
| Control name |
initial_mass |
| Assignment |
= |
| String |
'h1' |
| Number |
0.02, 1d-3, -101d0 |
| Logical |
.true. .false. |
| Comment |
! this is a comment |
Colors follow the active VS Code theme automatically (standard TextMate scopes).
Validation (the "semi-compiler")
The control database is generated by parsing the actual MESA source:
star/defaults/*.defaults, binary/defaults/*.defaults, astero/defaults/*.defaults,
eos/defaults/eos.defaults, kap/defaults/kap.defaults, colors/defaults/colors.defaults
— for names, defaults, docs and documented option lists.
- The Fortran
*.inc / *_ctrls_io.f90 declaration files — for exact types
(real / integer / logical / character) and array dimensions.
- The Fortran
namelist /.../ declarations — the authoritative list of valid
control names (catches controls that are settable but missing from the
documentation).
Each assignment in an inlist is checked against its namelist section:
- Unknown control → error.
- Control used in the wrong section → error with a hint pointing at the
correct section.
- Wrong value type → error (e.g. a string assigned to a real control).
- Unknown string option → warning (only when the control documents its
options).
Note: MESA itself is case-insensitive for control names, and the validator is
too. Logical literals are accepted with or without the trailing dot (.true
and .true. both work).
Settings
| Setting |
Default |
Meaning |
mesaInlist.mesaDir |
"" |
Path to a MESA source tree for runtime re-parsing (any version). Empty = use the embedded 26.4 database. |
mesaInlist.reportUnknownControls |
true |
Mark unknown control names red. Disable if you rely on many custom run_star_extras controls. |
mesaInlist.reportUnknownNamelists |
false |
Also warn about unrecognised namelist sections (custom namelists). |
mesaInlist.enableValueTypeChecking |
true |
Validate value types. |
mesaInlist.enableEnumChecking |
true |
Warn on undocumented string options. |
Commands
- MESA Inlist: Reload control database from MESA_DIR — re-parse a MESA tree
(set
mesaInlist.mesaDir first). Lets the extension work with any MESA version.
- MESA Inlist: Treat current file as a MESA inlist — force the language on the
active file.
Building from source
npm install
npm run compile # compile TypeScript to out/
npm run generate -- /path/to/mesa # regenerate the control database
npx @vscode/vsce package # produce mesa-inlist-*.vsix
Installing
Build the .vsix and run Extensions: Install from VSIX… in VS Code, or copy
the project folder into ~/.vscode/extensions/ (name it mesa-inlist).
License
MIT