mirror of
https://github.com/github/semantic.git
synced 2025-01-03 13:02:37 +03:00
Output grandParentAnnotation doc
This commit is contained in:
parent
139b45f3e4
commit
d86c12d672
@ -61,7 +61,7 @@ diffSummaries blobs diff = summaryToTexts =<< diffToDiffSummaries (source <$> bl
|
||||
-- Takes a 'DiffSummary' and returns a list of summary texts representing the LeafInfos
|
||||
-- in that 'DiffSummary'.
|
||||
summaryToTexts :: DiffSummary DiffInfo -> [Either Text Text]
|
||||
summaryToTexts DiffSummary{..} = runJoin . fmap (show . (<+> maybeParentContext parentAnnotation)) <$> (Join <$> summaries patch)
|
||||
summaryToTexts DiffSummary{..} = runJoin . fmap (show . (<+> (maybeGrandParentContext grandParentAnnotation <+> "/" <+> maybeParentContext parentAnnotation))) <$> (Join <$> summaries patch)
|
||||
|
||||
-- Returns a list of 'DiffSummary' given two source blobs and a diff.
|
||||
diffToDiffSummaries :: (HasCategory leaf, HasField fields Category, HasField fields Range) => Both (Source Char) -> SyntaxDiff leaf fields -> [DiffSummary DiffInfo]
|
||||
@ -184,6 +184,14 @@ maybeParentContext = maybe "" go
|
||||
where catName = toDoc $ toCategoryName c
|
||||
termName = toDoc t
|
||||
|
||||
maybeGrandParentContext :: Maybe (Category, Text) -> Doc
|
||||
maybeGrandParentContext = maybe "" go
|
||||
where go (c, t) = case c of
|
||||
C.Assignment -> "in an" <+> catName <+> "to" <+> termName
|
||||
_ -> "in the" <+> termName <+> catName
|
||||
where catName = toDoc $ toCategoryName c
|
||||
termName = toDoc t
|
||||
|
||||
toDoc :: Text -> Doc
|
||||
toDoc = string . toS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user