1{-# LANGUAGE OverloadedStrings #-}
5 , Compile.Artifacts(..)
15import qualified Data.ByteString as BS
16import qualified Data.Map as Map
17import qualified Data.Text as Text
18import qualified Text.PrettyPrint.ANSI.Leijen as P
20import qualified Compile
21import qualified Elm.Compiler.Module as M
22import qualified Elm.Compiler.Version
23import qualified Elm.Package as Pkg
24import qualified Json.Encode as Encode
25import qualified Reporting.Error as Error
26import qualified Reporting.Helpers as H
27import qualified Reporting.Render.Code as Code
28import qualified Reporting.Region as Region
29import qualified Reporting.Report as Report
30import qualified Reporting.Result as Result
31import qualified Reporting.Warning as Warning
40 Elm.Compiler.Version.version
49 { _package :: Pkg.Name
51 , _imports :: Map.Map M.Raw M.Canonical
52 , _interfaces :: M.Interfaces
56compile :: Context -> BS.ByteString -> ([Warning.Warning], Either [Error.Error] Compile.Artifacts)
57compile (Context pkg exposed importDict interfaces) source =
60 if exposed then Compile.YesDocs else Compile.NoDocs
62 Result.run $ Compile.compile docsFlag pkg importDict interfaces source
69errorsToDoc :: FilePath -> Text.Text -> [Error.Error] -> H.Doc
70errorsToDoc filePath source errors =
73 concatMap (Error.toReports (Code.toSource source) Map.empty) errors
75 H.vcat $ map (Report.toDoc filePath) reports
82errorsToJson :: M.Raw -> FilePath -> Text.Text -> [Error.Error] -> Encode.Value
83errorsToJson moduleName filePath source errors =
86 concatMap (Error.toReports (Code.toSource source) Map.empty) errors
89 [ ("path", Encode.text (Text.pack filePath))
90 , ("name", Encode.name moduleName)
91 , ("errors", Encode.array (map reportToJson reports))
95reportToJson :: Report.Report -> Encode.Value
96reportToJson (Report.Report title region _sgstns message) =
99 P.displayS (P.renderPretty 1 80 message) ""
102 [ ("title", Encode.text (Text.pack title))
103 , ("region", Region.encode region)
104 , ("message", Encode.text (Text.pack messageString))
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