origami

A long line of ABAP, folded into shape.

origami formats ABAP and CDS. It changes line breaks, indentation, spaces and letter case, nothing else, and it checks its own output token by token before it writes a file.

brew install nimble-123/tap/origami
DATA(ls_rule) = zcl_flight_rules=>get( iv_carrier = is_flight-carrid
                                       iv_date    = sy-datum
                                       iv_mode    = 'A' ).

ABAP-CALL-001: one parameter per line, because the call would end at column 103 (limit 72)

A method call that is 103 characters long, formatted at a line width of 72: one parameter per line, with the note that explains the break.

Try it on your code

Paste ABAP or CDS. It runs in your browser: origami compiled to WebAssembly, nothing is uploaded.

Formatted

Loading origami…

It never changes what your code means

After formatting, origami reads its own output back and compares every token and every comment with your file. Only whitespace, line breaks and letter case may differ.

Your file is lexed, parsed and laid out, and printed. The self-check compares the tokens with the input: if they are the same, the file is written; if not, the unit is kept as written and printed again; if it still differs, the file stays unchanged with error X001.

Every fold has a reason

origami --review shows what would change before anything is written, and below each construct it broke, the rule and the column the line would have ended at. In VS Code, origami: Preview Changes opens the same changes in the diff view.

Terminal: origami --review on an ABAP class at line width 80. The method signature, a method call and a SELECT are broken onto several lines; notes name ABAP-METHODS-001, ABAP-CALL-001 and ABAP-SQL-001 with the columns 88, 93 and 101.

Fast enough for every save

A median file takes 0.08 ms in a running editor or agent and 2.2 ms as a new process, start included; 99 % of files take under 5 ms. The 2,100-file test corpus takes 0.2 s, so format-on-save and pre-commit hooks stay out of your way.

Time per call, median and 99th percentile: origami in process 0.08 and 4.5 ms, through MCP 0.22 and 7.6 ms, in WebAssembly 0.26 and 14 ms, as a new process 2.2 and 3.1 ms; ABAP Cleaner with a warm JVM 2.0 and 59 ms, with a new JVM 315 and 355 ms.
Apple M4. ABAP Cleaner also changes code; origami only changes layout (layout compared side by side). All measurements, including the whole corpus and thread scaling.

Install

origami is a single binary for macOS, Linux and Windows. It reads origami.toml for line width, indentation and keyword case.

Homebrew
brew install nimble-123/tap/origami
Format a repository
origami formats every ABAP and CDS file below the current folder; origami --check only reports.
Only what you changed
origami --changed main formats the lines you touched since main.
VS Code
The extension in every release formats on save, works with ADT for VS Code and adds Preview Changes.
GitHub Actions
uses: nimble-123/origami@v0.2.3 with args: --check; GitLab, Azure Pipelines and pre-commit in the CI guide.
AI agents
origami --mcp runs an MCP server; agents get compact diagnostics with a next step.