mirror of
https://github.com/github/semantic.git
synced 2024-11-24 08:54:07 +03:00
A typesetting that shows whitespace for help debugging
This commit is contained in:
parent
a923fb0938
commit
071d91f494
@ -1,6 +1,7 @@
|
|||||||
module Reprinting.Typeset
|
module Reprinting.Typeset
|
||||||
( typeset
|
( typeset
|
||||||
, typesetting
|
, typesetting
|
||||||
|
, typesettingWithVisualWhitespace
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Prologue
|
import Prologue
|
||||||
@ -24,3 +25,16 @@ step (Layout (Indent 0 Spaces)) = mempty
|
|||||||
step (Layout (Indent n Spaces)) = stimes n space
|
step (Layout (Indent n Spaces)) = stimes n space
|
||||||
step (Layout (Indent 0 Tabs)) = mempty
|
step (Layout (Indent 0 Tabs)) = mempty
|
||||||
step (Layout (Indent n Tabs)) = stimes n "\t"
|
step (Layout (Indent n Tabs)) = stimes n "\t"
|
||||||
|
|
||||||
|
-- | Typeset, but show whitespace with printable characters for debugging purposes.
|
||||||
|
typesettingWithVisualWhitespace :: Monad m => ProcessT m Splice (Doc a)
|
||||||
|
typesettingWithVisualWhitespace = auto step where
|
||||||
|
step :: Splice -> Doc a
|
||||||
|
step (Emit t) = pretty t
|
||||||
|
step (Layout SoftWrap) = softline
|
||||||
|
step (Layout HardWrap) = "\\n" <> hardline
|
||||||
|
step (Layout Space) = "."
|
||||||
|
step (Layout (Indent 0 Spaces)) = mempty
|
||||||
|
step (Layout (Indent n Spaces)) = stimes n "."
|
||||||
|
step (Layout (Indent 0 Tabs)) = mempty
|
||||||
|
step (Layout (Indent n Tabs)) = stimes n "\t"
|
||||||
|
Loading…
Reference in New Issue
Block a user