File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
ghcide/src/Development/IDE/Spans Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -386,8 +386,11 @@ defRowToSymbolInfo (DefRow{..}:.(modInfoSrcFile -> Just srcFile))
386
386
end = Position (defELine - 1 ) (defECol - 1 )
387
387
defRowToSymbolInfo _ = Nothing
388
388
389
- pointCommand :: HieASTs t -> Position -> (HieAST t -> a ) -> [a ]
390
- pointCommand hf pos k =
389
+ pointCommand :: HieASTs t -- ^ Get AST
390
+ -> Position -- ^ point at position
391
+ -> (HieAST t -> a ) -- ^ extact data with a getter
392
+ -> [a ] -- ^ all data recieved
393
+ pointCommand hf pos getter =
391
394
catMaybes $ M. elems $ flip M. mapWithKey (getAsts hf) $ \ fs ast ->
392
395
-- Since GHC 9.2:
393
396
-- getAsts :: Map HiePath (HieAst a)
@@ -399,9 +402,8 @@ pointCommand hf pos k =
399
402
--
400
403
-- 'coerce' here to avoid an additional function for maintaining
401
404
-- backwards compatibility.
402
- case selectSmallestContaining (sp $ coerce fs) ast of
403
- Nothing -> Nothing
404
- Just ast' -> Just $ k ast'
405
+ let smallestRange = selectSmallestContaining (sp $ coerce fs) ast in
406
+ fmap getter smallestRange
405
407
where
406
408
sloc fs = mkRealSrcLoc fs (line+ 1 ) (cha+ 1 )
407
409
sp fs = mkRealSrcSpan (sloc fs) (sloc fs)
You can’t perform that action at this time.
0 commit comments