Skip to content

Preserve grouping of module items #521

@copy

Description

@copy

Consider this cut down human-formatted code:

let cmos_rtc_seconds = 0x00
let cmos_rtc_seconds_alarm = 0x01
let cmos_rtc_minutes = 0x02

let log_other = 0x000001
let log_cpu = 0x000002
let log_fpu = 0x000004

let cr0_pe = 1 lsl 0
let cr0_mp = 1 lsl 1
let cr0_em = 1 lsl 2

Depending on the configuration, ocamlformat either drops the newlines or adds newlines between every let binding, while I'd like to preserve the grouping. I don't consider this a failure of the formatter, as I don't expect the formatter to understand how to group top-level bindings by their semantics, but I do find the human-formatted version much more readable.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions