1
1
mirror of https://github.com/github/semantic.git synced 2024-12-24 07:25:44 +03:00

Update comment, extract appendParentContexts function

This commit is contained in:
Rick Winfrey 2016-10-14 11:53:34 -05:00
parent 8960836bcb
commit 014a6a21d7

View File

@ -104,6 +104,12 @@ diffToDiffSummaries sources = para $ \diff ->
where
(beforeSource, afterSource) = runJoin sources
-- Takes a 'DiffSummary DiffInfo' and returns a list of JSON Summaries whose text summaries represent the LeafInfo summaries of the 'DiffSummary'.
summaryToTexts :: DiffSummary DiffInfo -> [JSONSummary Text SourceSpans]
summaryToTexts DiffSummary{..} = appendParentContexts <$> summaries patch
where appendParentContexts jsonSummary =
jsonSummary { summary = show $ summary jsonSummary <+> parentContexts parentAnnotation }
-- Flattens a patch of diff infos into a list of docs, one for every 'LeafInfo' or `ErrorInfo` it contains.
summaries :: Patch DiffInfo -> [JSONSummary Doc SourceSpans]
summaries = \case