remove space in end of imports when formatting (#458)

This commit is contained in:
Justin Woo 2018-06-11 15:00:38 +02:00 committed by Gabriel Gonzalez
parent 636750bfdb
commit 3c051258c8
6 changed files with 31 additions and 3 deletions

View File

@ -180,19 +180,18 @@ instance Semigroup ImportType where
instance Buildable ImportType where
build (Local prefix file) =
build prefix <> build file <> " "
build prefix <> build file
build (URL prefix file suffix headers) =
build prefix
<> build file
<> build suffix
<> foldMap buildHeaders headers
<> " "
where
buildHeaders h = " using " <> build h
build (Env env) =
"env:" <> build env <> " "
"env:" <> build env
-- | How to interpret the import's contents (i.e. as Dhall code or raw text)
data ImportMode = Code | RawText deriving (Eq, Ord, Show)

View File

@ -39,6 +39,12 @@ formatTests =
, should
"indent then/else to the same column"
"ifThenElse"
, should
"handle indenting long imports correctly without trailing space per line"
"importLines"
, should
"handle indenting small imports correctly without trailing space inline"
"importLines2"
]
opts :: Data.Text.Prettyprint.Doc.LayoutOptions

View File

@ -0,0 +1,2 @@
let _ = ./emptyRecordA.dhall
in let _ = ./emptyRecordA.dhall in 123

View File

@ -0,0 +1 @@
let _ = ./emptyRecordA.dhall in let _ = ./emptyRecordA.dhall in 123

View File

@ -0,0 +1,7 @@
let _ = ./emptyRecordA.dhall
in let _ = ./emptyRecordA.dhall
in let _ = ./emptyRecordA.dhall
in let _ = ./emptyRecordA.dhall
in let _ = ./emptyRecordA.dhall
in let _ = ./emptyRecordA.dhall
in 123

View File

@ -0,0 +1,13 @@
let _ = ./emptyRecordA.dhall
in let _ = ./emptyRecordA.dhall
in let _ = ./emptyRecordA.dhall
in let _ = ./emptyRecordA.dhall
in let _ = ./emptyRecordA.dhall
in let _ = ./emptyRecordA.dhall
in 123