Skip to content

haskell-sort-imports does not recognize multi-line imports #270

Closed
@bos

Description

@bos

If I have an import that spans multiple lines, haskell-sort-imports does two things wrong.

Firstly, it can't tell that it's on a continuation line. If I try sorting imports with the cursor on the line marked CURSOR 1 below, it does nothing.

import Data.Aeson.Encode (encode)
import Data.Aeson.Types        {- CURSOR 2 -}
import Data.Aeson.Parser.Internal (decodeWith, decodeStrictWith,
                                   eitherDecodeWith, eitherDecodeStrictWith,
{- CURSOR 1  -}          jsonEOF, json, jsonEOF', json')
import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy as L

Secondly, if I move the cursor to CURSOR 2 and sort, I get this:

import Data.Aeson.Encode (encode)
import Data.Aeson.Parser.Internal (decodeWith, decodeStrictWith,
import Data.Aeson.Types
                                   eitherDecodeWith, eitherDecodeStrictWith,
                                   jsonEOF, json, jsonEOF', json')
import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy as L

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions