remove space in end of imports when formatting (#458)
This commit is contained in:
parent
636750bfdb
commit
3c051258c8
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
2
tests/format/importLines2A.dhall
Normal file
2
tests/format/importLines2A.dhall
Normal file
|
@ -0,0 +1,2 @@
|
|||
let _ = ./emptyRecordA.dhall
|
||||
in let _ = ./emptyRecordA.dhall in 123
|
1
tests/format/importLines2B.dhall
Normal file
1
tests/format/importLines2B.dhall
Normal file
|
@ -0,0 +1 @@
|
|||
let _ = ./emptyRecordA.dhall in let _ = ./emptyRecordA.dhall in 123
|
7
tests/format/importLinesA.dhall
Normal file
7
tests/format/importLinesA.dhall
Normal 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
|
13
tests/format/importLinesB.dhall
Normal file
13
tests/format/importLinesB.dhall
Normal 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
|
Loading…
Reference in New Issue
Block a user