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

Take the actual lines on both sides.

We were getting the wrong ranges.
This commit is contained in:
Rob Rix 2016-05-25 17:10:14 -04:00
parent 5fad7be0f5
commit b0d154271c

View File

@ -200,8 +200,11 @@ branchElementKey (Child key _) = Just key
branchElementKey _ = Nothing
alignBranchElement :: BranchElement -> [BranchElement]
alignBranchElement (Child key contents) = Child key <$> crosswalk lines contents
alignBranchElement (Margin contents) = Margin <$> crosswalk lines contents
alignBranchElement element = case element of
Child key contents -> Child key <$> crosswalk lines contents
Margin contents -> Margin <$> crosswalk lines contents
where lines = fmap toList . Source.actualLines . Source.fromList
toAlignBranchInputs :: [BranchElement] -> (Both (Source.Source Char), [(String, [Join These Range])], Both [Range])
toAlignBranchInputs elements = (sources, join . (`evalState` both 0 0) . mapM go $ elements, ranges)