1
1
mirror of https://github.com/github/semantic.git synced 2024-12-26 00:12:29 +03:00

Stub out better slicing of source line

This commit is contained in:
Timothy Clem 2020-01-14 12:37:12 -08:00
parent 1125cb6ce2
commit 164cb506ea

View File

@ -191,9 +191,12 @@ enterScope createNew m = do
instance ToTagsBy 'Custom Rb.Method where instance ToTagsBy 'Custom Rb.Method where
tags' t@Rb.Method tags' t@Rb.Method
{ ann = loc@Loc { byteRange = range } { ann = loc@Loc { byteRange = range@Range { start } }
, name = expr , name = expr
} = yieldMethodNameTag t loc range expr , parameters
} = case parameters of
Just Rb.MethodParameters { ann = Loc { byteRange = Range { end } }} -> yieldMethodNameTag t loc (Range start end) expr
_ -> yieldMethodNameTag t loc range expr
instance ToTagsBy 'Custom Rb.SingletonMethod where instance ToTagsBy 'Custom Rb.SingletonMethod where
tags' t@Rb.SingletonMethod tags' t@Rb.SingletonMethod
@ -266,7 +269,8 @@ instance ToTagsBy 'Custom Rb.Lhs where
instance ToTagsBy 'Custom Rb.MethodCall where instance ToTagsBy 'Custom Rb.MethodCall where
tags' t@Rb.MethodCall tags' t@Rb.MethodCall
{ ann = loc@Loc { byteRange = range } { ann = loc@Loc { byteRange = byteRange@Range {} }
, block
, method = expr , method = expr
} = case expr of } = case expr of
Prj (Rb.Variable (Prj Rb.Identifier { text = name })) -> yield name Call Prj (Rb.Variable (Prj Rb.Identifier { text = name })) -> yield name Call
@ -280,6 +284,11 @@ instance ToTagsBy 'Custom Rb.MethodCall where
_ -> gtags t _ -> gtags t
_ -> gtags t _ -> gtags t
where where
-- Don't include the block in the range
range = case block of
-- Just (Prj Rb.Block { ann = Loc { byteRange = Range { start = end } } }) -> Range start end
-- Just (Prj Rb.DoBlock { ann = Loc { byteRange = Range { start = end } } }) -> Range start end
_ -> byteRange
yield name kind = yieldTag name kind loc range >> gtags t yield name kind = yieldTag name kind loc range >> gtags t
instance ToTagsBy 'Custom Rb.Alias where instance ToTagsBy 'Custom Rb.Alias where