Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Newline character added after all comments when refactoring is applied. #306

Open
@Friede80

Description

@Friede80

Before:
image

After applying the Eta Reduce hint (the fact that the hint is not actually applied is a known issue with apply-refact, but the newline issue manifests when applying any hint)
image

Relevant log output:

2017-08-20 22:45:42.5956108 [ThreadId 6] - applyHint:ideas=[C:\Users\Friede\AppData\Local\Temp\ghc-mod94877\Main2292916541.hs:6:1: Warning: Eta reduce
Found:
  foo x = head x
Why not:
  foo = head
]
2017-08-20 22:45:42.5996146 [ThreadId 6] - applyHint:commands=[("C:\\Users\\Friede\\AppData\\Local\\Temp\\ghc-mod94877\\Main2292916541.hs:6:1: Warning: Eta reduce\nFound:\n  foo x = head x\nWhy not:\n  foo = head\n",[])]
2017-08-20 22:45:42.7359376 [ThreadId 6] - applyHint:applied="-- My Comment 1\r\nmain :: IO ()\nmain = putStrLn \"Hello World\"\n\n-- My Comment 2\r\nfoo x = head x\n\n-- Another Comment\r\n\nbaz = undefined\n"
2017-08-20 22:45:42.7399396 [ThreadId 6] - applyHint:diff=WorkspaceEdit {_changes = Just (fromList [(Uri {getUri = "file:///e%3A/Coding/TestProj/app/Main.hs"},List [TextEdit {_range = Range {_start = Position {_line = 0, _character = 0}, _end = Position {_line = 0, _character = 15}}, _newText = "-- My Comment 1\r"},TextEdit {_range = Range {_start = Position {_line = 4, _character = 0}, _end = Position {_line = 4, _character = 15}}, _newText = "-- My Comment 2\r"},TextEdit {_range = Range {_start = Position {_line = 7, _character = 0}, _end = Position {_line = 7, _character = 18}}, _newText = "-- Another Comment\r"}])]), _documentChanges = Nothing}

I am on Windows 10. I suspect some issue with Windows line endings, because of the appearance of \r in the diff. But the file is using Unix line endings.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions