mirror of
https://github.com/github/semantic.git
synced 2025-01-04 13:34:31 +03:00
Line JSON contains the range of all the diffs on the line.
This commit is contained in:
parent
5eaa843abc
commit
d5f9b170d4
@ -60,7 +60,9 @@ instance ToJSON (Term leaf Info) where
|
||||
toEncoding (info :< syntax) = pairs $ mconcat (termFields info syntax)
|
||||
|
||||
lineFields :: KeyValue kv => Int -> Line (SplitDiff leaf Info) -> [kv]
|
||||
lineFields n line = [ "number" .= n, "terms" .= unLine line, "hasChanges" .= hasChanges line ]
|
||||
lineFields n line = [ "number" .= n, "terms" .= unLine line, "range" .= unionRanges (getRange <$> line), "hasChanges" .= hasChanges line ]
|
||||
where getRange (Free (Annotated (Info range _) _)) = range
|
||||
getRange (Pure patch) = case getSplitTerm patch of Info range _ :< _ -> range
|
||||
|
||||
termFields :: (ToJSON recur, KeyValue kv) => Info -> Syntax leaf recur -> [kv]
|
||||
termFields (Info range categories) syntax = "range" .= range : "categories" .= categories : case syntax of
|
||||
|
Loading…
Reference in New Issue
Block a user