diff --git a/src/Renderer.hs b/src/Renderer.hs index 96a97884f..a79a6bac5 100644 --- a/src/Renderer.hs +++ b/src/Renderer.hs @@ -60,8 +60,8 @@ data ParseTreeRenderer fields output where resolveParseTreeRenderer :: (Monoid output, StringConv output ByteString) => ParseTreeRenderer fields output -> SourceBlob -> Term (Syntax Text) (Record fields) -> output resolveParseTreeRenderer renderer blob = case renderer of SExpressionParseTreeRenderer format -> R.sExpressionParseTree format blob - JSONParseTreeRenderer True -> R.jsonParseTree blob . decoratorWithAlgebra (fToR identifierAlg) . decoratorWithAlgebra (sourceDecorator (source blob)) - JSONParseTreeRenderer False -> R.jsonParseTree blob . decoratorWithAlgebra (fToR identifierAlg) + JSONParseTreeRenderer True -> R.jsonFile blob . decoratorWithAlgebra (fToR identifierAlg) . decoratorWithAlgebra (sourceDecorator (source blob)) + JSONParseTreeRenderer False -> R.jsonFile blob . decoratorWithAlgebra (fToR identifierAlg) JSONIndexParseTreeRenderer True -> R.jsonIndexParseTree blob . decoratorWithAlgebra (fToR identifierAlg) . decoratorWithAlgebra (sourceDecorator (source blob)) JSONIndexParseTreeRenderer False -> R.jsonIndexParseTree blob . decoratorWithAlgebra (fToR identifierAlg) where sourceDecorator source (ann :< _) = Just (SourceText (toText (Source.slice (byteRange ann) source))) diff --git a/src/Renderer/JSON.hs b/src/Renderer/JSON.hs index 4b0d94c5c..96d367bb0 100644 --- a/src/Renderer/JSON.hs +++ b/src/Renderer/JSON.hs @@ -4,7 +4,6 @@ module Renderer.JSON ( json , jsonFile -, jsonParseTree , jsonIndexParseTree , ToJSONFields(..) , Identifier(..) @@ -207,9 +206,6 @@ instance ToJSONFields Identifier where jsonFile :: ToJSON a => SourceBlob -> a -> Value jsonFile SourceBlob{..} = toJSON . File path -jsonParseTree :: ToJSONFields (Record fields) => SourceBlob -> Term (Syntax Text) (Record fields) -> Value -jsonParseTree = jsonFile - jsonIndexParseTree :: (ToJSONFields (Record fields), HasField fields (Maybe Identifier)) => SourceBlob -> Term (Syntax Text) (Record fields) -> Value jsonIndexParseTree blob = jsonFile blob . fmap (object . toJSONFields) . cata combine where combine (a :< f) | Nothing <- getField a :: Maybe Identifier = Prologue.concat f