This commit is contained in:
Pepe Iborra 2020-01-06 08:17:22 +00:00 committed by Moritz Kiefer
parent 821c7f6ffa
commit f8e6ab171f
2 changed files with 11 additions and 7 deletions

View File

@ -142,12 +142,16 @@ spansAtPoint :: Position -> [SpanInfo] -> [SpanInfo]
spansAtPoint pos = filter atp where spansAtPoint pos = filter atp where
line = _line pos line = _line pos
cha = _character pos cha = _character pos
atp SpanInfo{..} = spaninfoStartLine <= line atp SpanInfo{..} =
&& spaninfoEndLine >= line startsBeforePosition && endsAfterPosition
&& spaninfoStartCol <= cha where
-- The end col points to the column after the startLineCmp = compare spaninfoStartLine line
-- last character so we use > instead of >= endLineCmp = compare spaninfoEndLine line
&& spaninfoEndCol > cha
startsBeforePosition = startLineCmp == LT || (startLineCmp == EQ && spaninfoStartCol <= cha)
-- The end col points to the column after the
-- last character so we use > instead of >=
endsAfterPosition = endLineCmp == GT || (endLineCmp == EQ && spaninfoEndCol > cha)
showName :: Outputable a => a -> T.Text showName :: Outputable a => a -> T.Text
showName = T.pack . prettyprint showName = T.pack . prettyprint

View File

@ -954,7 +954,7 @@ findDefinitionAndHoverTests = let
, test broken broken fffL8 fff "field in record construction #71" , test broken broken fffL8 fff "field in record construction #71"
, test yes yes fffL14 fff "field name used as accessor" -- 120 in Calculate.hs , test yes yes fffL14 fff "field name used as accessor" -- 120 in Calculate.hs
, test yes yes aaaL14 aaa "top-level name" -- 120 , test yes yes aaaL14 aaa "top-level name" -- 120
, test broken broken dcL7 tcDC "data constructor record #247" , test yes yes dcL7 tcDC "data constructor record #247"
, test yes yes dcL12 tcDC "data constructor plain" -- 121 , test yes yes dcL12 tcDC "data constructor plain" -- 121
, test yes yes tcL6 tcData "type constructor #248" -- 147 , test yes yes tcL6 tcData "type constructor #248" -- 147
, test broken yes xtcL5 xtc "type constructor external #248,249" , test broken yes xtcL5 xtc "type constructor external #248,249"