gbdev / gbdev/rgbds

RGBFMT tool to fix code formatting

Open
#1,796 4 comments 0 reactions 0 assignees View on GitHub
enhancement good first issue new tool
Dominant language
C++
Stars
1.6k
Forks
193
Avg merge
1d 33m
Merged PRs (30d)
23

Description

Modern programming languages tend to have auto-formatters. It would be worthwhile to have one for RGBASM as well, supporting users' various preferred styles.

Configurable options (not meant as a complete list):

- **Indentation:** tabs or N spaces
- **Max line length:** backslash line continuations could apply for long lines (0 = no limit)
- **Case:** lower or UPPER, separately configurable for:
- hex digits
- instructions/registers/conditions
- directives/keywords
- plus a way to special-case some (e.g. lowercase everything except `MACRO/ENDM` and `SECTION/ENDSECTION`)
- **Instructions:** some instructions have alternatives
- the optional `a` argument for `add`, `sub`, `cpl`, etc
- `ld [hli/hld]` vs `ld [hl+/hl-]` vs `ldi/ldd [hl]`
- `ldh [c]` vs `ld [$ff00+c]`
- `nz/nc` vs `!z/!c`
- **Blank lines:** configure how many blank lines to put:
- before global labels
- before new sections
- before other directives
- **Anonymous labels:** put `:` on its own line, or on the same line as the subsequent instruction
- **Macros:** indent macro invocations or not (or e.g. indent all of them except `mycol1macro`)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.