1{-# OPTIONS_GHC -Wall #-}
2{-# LANGUAGE OverloadedStrings #-}
3module Reporting.Exit.Compile
11import Data.List.NonEmpty (NonEmpty((:|)))
12import qualified Data.List.NonEmpty as NonEmpty
13import qualified Data.Text as Text
14import qualified Data.Time.Clock as Time
15import qualified Text.PrettyPrint.ANSI.Leijen as P
17import qualified Elm.Compiler as Compiler
18import qualified Elm.Compiler.Module as Module
19import qualified Json.Encode as Encode
30 , _time :: Time.UTCTime
31 , _source :: Text.Text
32 , _errors :: [Compiler.Error]
40toJson :: Exit -> Encode.Value
41toJson (Exit name path _ source errors) =
42 Compiler.errorsToJson name path source errors
49toDoc :: Exit -> [Exit] -> P.Doc
51 case NonEmpty.sortWith _time (e :| es) of
53 P.vcat (toDocHelp exit exits)
56toDocHelp :: Exit -> [Exit] -> [P.Doc]
63 exitToDoc e1 : separator (_name e1) (_name e2) : toDocHelp e2 otherErrors
66exitToDoc :: Exit -> P.Doc
67exitToDoc (Exit _name path _time source errors) =
68 Compiler.errorsToDoc path source errors
71separator :: Module.Raw -> Module.Raw -> P.Doc
72separator beforeName afterName =
74 before = Module.nameToString beforeName ++ " ↑ "
75 after = " ↓ " ++ Module.nameToString afterName
78 [ P.indent (80 - length before) (P.text before)
79 , "====o======================================================================o===="
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list