edg DSL
Syntax highlighting for edg workload DSL files (.edg).
Features
- Syntax highlighting for
.edg files
- Embedded SQL highlighting in raw strings
- Bracket matching and auto-closing
- Comment toggling
- Colour themes:
edg Dark, edg Light, and six two-colour dark variants (Pink → Yellow, Yellow → Cyan, Cyan → Pink, Purple → Yellow, Pink → Purple, Purple → Cyan)
Highlighting support
- Keywords:
let, object, transaction, if, else, match, when, default, etc.
- Section blocks:
up, seed, deseed, down, init, run, stats, mutate
- Built-in functions:
gen, uuid_v4, ref, seq, timestamp, uniform.int etc.
- Option keys and their fixed values:
count:, type: exec_batch, expect: fail, on: [retryable]
- Mutation kinds inside
mutate: null, dup, fk_break, range
- Season terms and the variables a
weight expression reads: months, business_hours, month, hour
- Metrics inside
expect and inline assert:: error_rate, p99, tpm
- Strings, numbers, booleans, operators, and comments
- SQL keywords within raw strings (backtick-delimited)
- Placeholders:
$1, ?, __values__, __columns__
- Lint directives:
# edg:ignore, # edg:ignore-file
Words are highlighted where they mean something: a misspelled option key stays
plain, dup is a mutation kind only inside mutate, and season is a keyword
where it declares one and a function where it's called.
Example
let users = 100000
let batch_size = 10000
let fetch_limit = batch_size / 2
up {
create_users `CREATE TABLE IF NOT EXISTS users (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
email STRING NOT NULL
)`
}
seed {
populate_users(count: users, size: batch_size) `INSERT INTO users (email) __values__` (gen('email'))
fetch_users `SELECT id, email FROM users LIMIT $1` (fetch_limit)
}
run {
get_user `SELECT * FROM users WHERE id = $1::UUID` (ref('fetch_users').id)
update_email `UPDATE users SET email = $2 WHERE id = $1::UUID` (
ref('fetch_users').id,
gen('email')
)
}
deseed {
truncate_users `TRUNCATE TABLE users CASCADE`
}
down {
drop_users `DROP TABLE IF EXISTS users`
}
Links
| |