Add a directive to disable or modify formatting of full modules #197
Labels
No Label
blocked: dependency
blocked: info-needed
bug
duplicate
enhancement
fixed in HEAD
help wanted
hs:arrows
hs:brackets
hs:classes
hs:comments
hs:do-notation
hs:guards
hs:lists
hs:operators
hs:patterns
hs:records
hs:types
invalid
language extension support
layouting
needs confirmation
priority: high
priority: low
question
revisit before next release
wontfix
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: hexagoxel/brittany#197
Loading…
Reference in New Issue
There is no content yet.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?
We currently have directives for disabling/modifying specific bindings (
-- brittany-disable-next-binding
/-- brittany-next-binding --columns=100
, e.g.). Certain files either choke on brittany, or are written in a particular style and should be ignored by the process. In those cases, I'd love if there were a directive akin to:-- brittany-disable
which ignores the entire module; and similarly
-- brittany-modify
or something that that effect for modifying brittany settings for all top-level bindings in a module.This might seem weird since
brittany
works on a per-module basis, but this would be really nice when working with editor integrations and full-project formatting scripts, for example.I think both functionalities are in a way supported already:
The former is based on the assumption that exactprint does its job correctly (the risk of that failing is really really low, in my experience). But both for making things more intuitive and prevent wasting cpu-cycles on calculating a complex hopefully-identity, we probably indeed want "brittany-disable-module" that produces input directly (and does nothing on
--write-mode=inplace
).@lspitzner is there an FAQ that could be updated to include this information?
It seems like maybe the original issue is solved? But the inline config definitely should be documented. It's in the change log for 0.11 and in #136, but that's it.
Can anyone quickly say what the configuration looks like for this? I've tried every variant of
-- brittany disable-formatting
I can think of, but none of them seem to cause the file where this comment appears to be ignored.I think you can use
-- brittany --exactprint-only
, although it still seems to format the module header.My hope was actually to have a way to avoid https://github.com/lspitzner/brittany/issues/242 so this isn't quite enough; I'd just like the whole file to be completely ignored. I guess the only way to do this is just to make sure that brittany never looks at the file in the first place?
As far as I know, yeah that's the only way.