Fix record field comment indentation
parent
c367b1017b
commit
0381b9fe24
|
@ -392,6 +392,13 @@ data Foo = forall a b . (Show a, Eq b) => Bar
|
||||||
data MyData = MyData Int
|
data MyData = MyData Int
|
||||||
-- after
|
-- after
|
||||||
|
|
||||||
|
#test record newline comment
|
||||||
|
data MyRecord = MyRecord
|
||||||
|
{ a :: Int
|
||||||
|
-- comment
|
||||||
|
, b :: Int
|
||||||
|
}
|
||||||
|
|
||||||
#test record comments simple
|
#test record comments simple
|
||||||
data Foo = Bar -- a
|
data Foo = Bar -- a
|
||||||
{ foo :: Baz -- b
|
{ foo :: Baz -- b
|
||||||
|
|
|
@ -291,21 +291,22 @@ createDetailsDoc consNameStr details = case details of
|
||||||
IndentPolicyFree -> docAlt [singleLine, multiIndented]
|
IndentPolicyFree -> docAlt [singleLine, multiIndented]
|
||||||
RecCon (L _ []) -> docEmpty
|
RecCon (L _ []) -> docEmpty
|
||||||
#if MIN_VERSION_ghc(8,6,0) /* ghc-8.6 */
|
#if MIN_VERSION_ghc(8,6,0) /* ghc-8.6 */
|
||||||
RecCon lRec@(L _ [lField@(L _ (ConDeclField _ext names t _))]) -> docSeq
|
RecCon lRec@(L _ [lField@(L _ (ConDeclField _ext names t _))]) ->
|
||||||
#else
|
#else
|
||||||
RecCon lRec@(L _ [lField@(L _ (ConDeclField names t _))]) -> docSeq
|
RecCon lRec@(L _ [lField@(L _ (ConDeclField names t _))]) ->
|
||||||
#endif
|
#endif
|
||||||
[ docLit consNameStr
|
docSetIndentLevel $ docSeq
|
||||||
, docSeparator
|
[ docLit consNameStr
|
||||||
, docWrapNodePrior lRec $ docLit $ Text.pack "{"
|
, docSeparator
|
||||||
, docSeparator
|
, docWrapNodePrior lRec $ docLit $ Text.pack "{"
|
||||||
, docWrapNodeRest lRec $ docSeq $ createNamesAndTypeDoc lField names t
|
, docSeparator
|
||||||
, docSeparator
|
, docWrapNodeRest lRec $ docSeq $ fmap docForceSingleline $ createNamesAndTypeDoc lField names t
|
||||||
, docLit $ Text.pack "}"
|
, docSeparator
|
||||||
]
|
, docLit $ Text.pack "}"
|
||||||
|
]
|
||||||
RecCon lRec@(L _ fields@(_:_)) -> do
|
RecCon lRec@(L _ fields@(_:_)) -> do
|
||||||
let (fDoc1 : fDocR) = mkFieldDocs fields
|
let (fDoc1 : fDocR) = mkFieldDocs fields
|
||||||
docAddBaseY BrIndentRegular $ docPar
|
docAddBaseY BrIndentRegular $ docSetIndentLevel $ docPar
|
||||||
(docLit consNameStr)
|
(docLit consNameStr)
|
||||||
(docWrapNodePrior lRec $ docLines
|
(docWrapNodePrior lRec $ docLines
|
||||||
[ docCols ColRecDecl
|
[ docCols ColRecDecl
|
||||||
|
|
Loading…
Reference in New Issue