RGBDS is case-insensitive for everything except labels, so set
and SET
are the same. Developers have different rules for how they prefer code be capitalized. This extension supports a robust, inheritance-based rule system for configuring capitalization. It allows configuring simple rules in as few as a single declaration, but also allows highly granular configurations.
You configure capitalization through the rgbdsz80.formatting.capitalization
setting. It takes a dictionary containing scopes as keys and rules as values. The root scope is language
. Every case-insensitive part of the language is classified under a tree that branches from the root scope. Rules can be upper
or lower
.
A rule applies to everything in a scope. Rules with a narrower scope override rules with a broader scope.
"rgbdsz80.formatting.capitalization": {
"language": "lower",
}
include "MyHeader.inc"
section "My Section", rom0
routine::
ld a, 0
"rgbdsz80.formatting.capitalization": {
"language": "upper",
}
INCLUDE "MyHeader.inc"
SECTION "My Section", ROM0
routine::
LD A, 0
"rgbdsz80.formatting.capitalization": {
"language": "upper",
"language.keyword.sectiondeclaration": "lower"
}
INCLUDE "MyHeader.inc"
section "My Section", rom0
routine::
LD A, 0
"rgbdsz80.formatting.capitalization": {
"language": "upper",
"language.keyword.preprocessor.include": "lower"
}
include "MyHeader.inc"
SECTION "My Section", ROM0
routine::
LD A, 0
include, incbin, export, global, union, fragment, nextu, endu, print, println, printt, printv, printi, printf, fail, warn, if, elif, else, endc, endsection, purge, rept, endr, opt, popo, pusho, pops, pushs, equ, set, def, redef, equs, macro, endm, shift, charmap, newcharmap, setcharmap, pushc, popc, load, endl
rsreset, rb, rw, rl, db, dw, dl, ds
section, rom0, romx, vram, sram, wram0, wramx, oam, hram, align, bank
mul, sin, cos, tan, asin, acos, atan, atan2, strcat, strcmp, strin, strlen, strlwr, strsub, strupr, bank, def, high, low, isconst, ceil, floor, log, pow, round, strfmt, strrin, strrpl
a, f, b, c, d, e, h, l, af, bc, de, hl, hli, hld, sp, pc
z, nz, c, nc
adc, add, and, bit, call, ccf, cp, cpl, daa, dec, di, ei, halt, inc, jp, jr, ld, ldh, nop, or, pop, push, res, ret, reti, rl, rla, rlc, rlca, rr, rra, rrc, rrca, rst, sbc, scf, set, sla, sra, srl, stop, sub, swap, xor
Capitalization for the letter parts of hex number literals.