KerboScript (kOS) — VS Code Extension
Made by Quasy — A modern, fully up-to-date VS Code language extension for kOS (Kerbal Operating System), the in-game scripting mod for Kerbal Space Program.
Features
- Syntax Highlighting — Full coverage of all KerboScript keywords, operators, built-in variables, structures, functions, and constants
- Language Configuration — Auto-closing brackets and quotes, correct comment toggling with
Ctrl+/, smart indentation
- Snippets — 35+ ready-to-use code snippets for common patterns
Snippet List
| Prefix |
Description |
lazyglobal |
@lazyglobal off. pragma |
set |
Set a variable |
lock |
Lock to an expression |
local / global |
Variable declarations |
function / func |
Function definition |
if / ifelse |
Conditionals |
until |
Until loop |
from |
From-step-do loop (for loop) |
for |
For-each over a list |
when / whenp |
When/Then triggers (one-shot and repeating) |
on |
On-change trigger |
wait / waituntil |
Wait commands |
print / printat |
Terminal output |
cls |
Clear screen |
log |
Log to file |
stage |
Activate next stage |
throttle |
Lock throttle |
steering / steerheading |
Lock steering |
unsteer |
Unlock steering |
waitstage |
Stage when ready |
execnode |
Execute next maneuver node |
ascent |
Basic gravity-turn ascent template |
pid |
PID controller setup |
vec |
Vector constructor |
latlng |
Geographic coordinates |
node / addnode |
Maneuver nodes |
list |
List with add |
lex |
Lexicon (dictionary) |
hud |
HUD text overlay |
vecdraw |
Draw a 3D vector arrow |
run |
Run another script |
orbitinfo |
Print orbit data |
visviva |
Vis-viva delta-V calculation |
const |
kOS physics constant |
runonce |
Run-once module guard |
Language Support
What's highlighted
- Keywords —
set, lock, if, until, function, parameter, declare, local, global, etc.
- Control flow —
if, else, until, from/step/do, for/in, when/then, on, wait, return, break
- Built-ins —
ship, target, body, time, altitude, apoapsis, periapsis, throttle, steering, etc.
- Direction constants —
prograde, retrograde, radialin, radialout, normal, antinormal, up, north
- Math functions —
abs, sqrt, sin, cos, tan, arctan2, round, floor, ceiling, ln, log10, max, min, mod, random
- Constructors —
V(), R(), Q(), HEADING(), LATLNG(), NODE(), LIST(), LEXICON(), QUEUE(), STACK(), RANGE()
- Operators —
and, or, not, mod, =, <>, <=, >=, ^
- Delegate syntax —
funcname@
- Suffix access — highlighting after
: (e.g. ship:velocity:orbit:mag)
- Numbers — integers, floats, scientific notation
- Strings — double-quoted, with escape sequences
- Comments —
// line comments
- Pragma —
@lazyglobal off.
Requirements
Installation
See the Install Guide below.
Credit: Quasy | Based on the kOS documentation
| |