1
1
mirror of https://github.com/github/semantic.git synced 2024-12-25 16:02:43 +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 branchElementKey _ = Nothing
alignBranchElement :: BranchElement -> [BranchElement] alignBranchElement :: BranchElement -> [BranchElement]
alignBranchElement (Child key contents) = Child key <$> crosswalk lines contents alignBranchElement element = case element of
alignBranchElement (Margin contents) = Margin <$> crosswalk lines contents 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 :: [BranchElement] -> (Both (Source.Source Char), [(String, [Join These Range])], Both [Range])
toAlignBranchInputs elements = (sources, join . (`evalState` both 0 0) . mapM go $ elements, ranges) toAlignBranchInputs elements = (sources, join . (`evalState` both 0 0) . mapM go $ elements, ranges)