haskell/haskell-ide-engine

Newline character added after all comments when refactoring is applied.

Open

#306 opened on 2017年8月21日

GitHub で見る
 (5 comments) (0 reactions) (0 assignees)Haskell (205 forks)batch import
component: pluginhelp wantedos: windowsresolution: duplicatestatus: need confirmationtype: bug

Repository metrics

Stars
 (2,358 stars)
PR merge metrics
 (30d に merged PR はありません)

説明

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.

コントリビューターガイド