Whitespace added between comment and multi-line where clause #263
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#263
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?
It appears when formatting a function with a long comment about a multi-line
where
clause, brittany will add a bunch of whitespace that seems somehow related to the length of the comment.Input this into the online formatter (some function body has been omitted for brevity):
The output will show whitespace between the last line of the comment and the
where
:Further formatting will result in more whitespace.
The comment above is 8 lines and results in 9 lines of whitespace. Trimming the comment to 4 lines results in 5 lines of whitespace.
Shortening the definition of
isMultiple
(for instance, removingJust MultipleChoice
from the list) will result in it formatting to a single line with no whitespace.There also seems to be an issue here of indentation level. The code above is using special
where
indentation (1 space), but the comment is being indented with thedo
block (2 space). @stackptr what would you expect?this
or
This is fixed on master.
master
on the online formatter was updated, so it works there already.I think for the comment position nothing needs to be changed. The input is essentially already formatted, so brittany should not change anything about comment placement. Sometimes brittany changes comment indentation (e.g. if you have a comment in the middle of a
do
block and you switch from--indent 2
to--indent 4
) but generally retaining comment position including indentation exactly is a feature.Would it be possible to release a new version with the fix in it?