Look into proper line ending handling for non-"\n" os's #4
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#4
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?
If you are a windows/osx users, please point out if brittany's current behaviour regarding newlines needs fixing of any sort.
Is this a manifestation of https://github.com/alanz/ghc-exactprint/issues/29?
Yeah it is pretty much the same issue; it is my own fault for unconditionally using \n here though.
Ok, so no action required on ghc-exactprint for this?
well, yes and no.
First question is where to put input-newline-mode-detection. It kinda makes sense for exactprint's parsing functions to return that info, but that is not required.
Secondly https://github.com/alanz/ghc-exactprint/issues/29 is still relevant for the parts of the input not transformed by brittany which are just restored via exactprint.
I think this is causing issues on Windows. I'm using vscode with Haskell Language Server, and everytime I format a document it doubles the new lines:
(It uses birttany for formatting)
becomes:
I'll have to do some testing on windows.
I can confirm it works with LF, you can switch it in Linux too from status bar in VSCode:
But it fails if I switch to Windows default CRLF:
@Ciantic I cannot reproduce this particular line-duplication problem, having tested both the brittany executable and the library interface via the test in the brittany testsuite under windows on
\r\n
encoded input. For the executable, brittany seems to work correctly (i.e. produce\r\n
in the output). For the library interface, brittany (incorrectly) produces\n
-only output, i.e. brittany replaces\r\n
by\n
. But no line duplication either.If you are certain that brittany is at fault, please provide a brittany-specific testcase for reproduction.
I just walked into the exact same case as @Ciantic here:
https://github.com/lspitzner/brittany/issues/4#issuecomment-347202072
Using VS Code with the Haskell Language Server extension which claims to be using Brittany for formatting. I started this project with all default settings on Windows, so it was CRLF-ended. When chaning it to LF it seemed to go ok, but I don't know if there's a secret danger to that.