Formatter - prb28/vscode-amiga-assembly GitHub Wiki
Format a document
The assembly language will be formatted with the standard shortcuts :
- On Windows Shift + Alt + F
- On Mac Shift + Option + F
- On Ubuntu Ctrl + Shift + I
- or Ctrl + Shift + P (or Command + Shift + P on Mac), and then search for "Format Document".

Format a selection
- The format sizes are calculated only for the selection

Format on typing
- Activate option formatOnType in the settings
{
...
"editor.formatOnType": true,
...
}

Configure spacing between elements
| label | spacing | instruction | spacing | data | spacing | comment |
|---|---|---|---|---|---|---|
mylabel |
amiga-assembly.format.labelToInstructionDistance | move.l |
amiga-assembly.format.instructionToDataDistance | d0,a0 |
amiga-assembly.format.dataToCommentsDistance | ; mycomment |
Set a preferred comment and/or instruction position while formatting a source
- In the workspace or folder settings
{
...
"amiga-assembly.format.preferredCommentPosition": 80,
"amiga-assembly.format.preferredInstructionPosition": 10
...
}
| option | description |
|---|---|
| preferredCommentPosition | Column of the comments, if not possible it will be placed according to the value of dataToCommentsDistance |
| preferredInstructionPosition | Column of the instructions, if not possible it will be placed according to the value of labelToInstructionDistance |
Put a space after the commas separating the operands
- In the workspace or folder settings
{
...
"amiga-assembly.format.spaceAfterComma": true
...
}
The formatter puts one space after each comma separating the operands (default: false):
; before
start lea $dff000,a5
move.l (a0,d0.w),d1
; after
start lea $dff000, a5
move.l (a0,d0.w), d1
- The commas inside parenthesis, brackets, braces (addressing modes, bitfields) and strings are not changed.
- Several spaces after a comma are reduced to one space.
Warning: vasm needs the
-spacesoptionBy default vasm considers that a blank ends the operands field:
lea $dff000, a5is read aslea $dff000,followed by the commenta5, and it does not assemble. Add the-spacesoption to the vasm arguments of the build task (.vscode/tasks.json):"vasm": { "enabled": true, "command": "${config:amiga-assembly.binDir}/vasmm68k_mot", "args": [ "-m68000", "-Fhunk", "-linedebug", "-spaces" ] }With
-spacesthe comments after the operands must start with;. This applies to the included files too: some include files, like the official NDK ones (for examplehardware/cia.iwith* gameport 1, pin 6 (fire button*)comments), do not assemble anymore with this option.