This is my first bug report, if I did anything wrong just tell me so I can fix it and know for next time.
This was all done on revision e98a812
Currently, roc fmt removes comments in many cases when formatting blocks (be they code blocks, lists, or records)
Examples:
test = |{}| {
# Some informational comment on why this is empty
}
turning into:
or
turning into:
This is particularly relevant with things that are inline:
platform ""
requires {}
exposes [
# Stderr,
# EventQueue,
# Duration,
]
packages {
# This is where all the package stuff goes
}
provides {
"roc_init": init_for_host!,
# "roc_generate": generate_for_host!,
}
hosted { "hosted_stderr_line": Stderr.line!,
#"hosted_event_queue_enqueue": EventQueue.enqueue!
}
targets: {
inputs_dir: "targets/",
x64mac: { inputs: ["libhost.a", app] },
arm64mac: { inputs: ["libhost.a", app] },
x64musl: { inputs: ["crt1.o", "libhost.a", app, "libc.a"] },
arm64musl: { inputs: ["crt1.o", "libhost.a", app, "libc.a"] },
x64win: { inputs: ["host.lib", app] },
arm64win: { inputs: ["host.lib", app] },
}
Formats into:
platform ""
requires {}
exposes []
packages {}
provides { "roc_init": init_for_host! }
hosted { "hosted_stderr_line": Stderr.line! }
targets: {
inputs_dir: "targets/",
x64mac: { inputs: ["libhost.a", app] },
arm64mac: { inputs: ["libhost.a", app] },
x64musl: { inputs: ["crt1.o", "libhost.a", app, "libc.a"] },
arm64musl: { inputs: ["crt1.o", "libhost.a", app, "libc.a"] },
x64win: { inputs: ["host.lib", app] },
arm64win: { inputs: ["host.lib", app] },
}
Notability, uncommenting any combination of the three exposes will preserve the entire block and it's comments.
I imagine these are all different cases in the formatter, and I can try to look into it more and split up the issue into solitary issues. There are also likely more cases then these.
This is my first bug report, if I did anything wrong just tell me so I can fix it and know for next time.
This was all done on revision e98a812
Currently,
roc fmtremoves comments in many cases when formatting blocks (be they code blocks, lists, or records)Examples:
turning into:
test = |{}| {}or
turning into:
This is particularly relevant with things that are inline:
Formats into:
Notability, uncommenting any combination of the three exposes will preserve the entire block and it's comments.
I imagine these are all different cases in the formatter, and I can try to look into it more and split up the issue into solitary issues. There are also likely more cases then these.