Skip to content

Commit d065a0a

Browse files
committed
refactor: correct comment location
1 parent efc434b commit d065a0a

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

ghcide/src/Development/IDE/Plugin/TypeLenses.hs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -484,18 +484,20 @@ findBindingsQ = something (mkQ Nothing findBindings)
484484
(col (getLoc fun_id) - col (getLoc bind))
485485
in Just $ pure localBinding
486486
PatBind{..} ->
487-
Just $ (everything (<>) $ mkQ [] (fmap (uncurry wb) . maybeToList . findIdFromPat)) pat_lhs
488-
where
489-
wb id srcSpan = LocalBinding id srcSpan (col srcSpan - col (getLoc pat_lhs))
487+
let wb id srcSpan = LocalBinding id srcSpan (col srcSpan - col (getLoc pat_lhs))
488+
489+
-- | Example: Find `a` and `b` from @(a,b) = (1,True)@
490+
findIdFromPat :: Pat GhcTc -> Maybe (Id, SrcSpan)
491+
findIdFromPat (VarPat _ located) = Just (unLoc located, getLoc located)
492+
findIdFromPat _ = Nothing
493+
494+
findIdsFromPat :: LocatedA (Pat GhcTc) -> [LocalBinding]
495+
findIdsFromPat = everything (<>) $ mkQ [] (fmap (uncurry wb) . maybeToList . findIdFromPat)
496+
in Just $ findIdsFromPat pat_lhs
490497
_ -> Nothing
491498
where
492499
col = srcSpanStartCol . realSrcSpan
493500

494-
-- | Example: Find `a` and `b` from @(a,b) = (1,True)@
495-
findIdFromPat :: Pat GhcTc -> Maybe (Id, SrcSpan)
496-
findIdFromPat (VarPat _ located) = Just (unLoc located, getLoc located)
497-
findIdFromPat _ = Nothing
498-
499501
findSigIds :: GenLocated l (Sig GhcRn) -> [IdP GhcRn]
500502
findSigIds (L _ (TypeSig _ names _)) = map unLoc names
501503
findSigIds _ = []

0 commit comments

Comments
 (0)