From f09c3888681689cca72db0f01e6e24a4ef96222e Mon Sep 17 00:00:00 2001 From: Simon Jakobi Date: Tue, 11 Nov 2025 12:53:17 +0100 Subject: [PATCH] getLocatedImportsRule: "Simplify" some bogus logic --- ghcide/src/Development/IDE/Core/Rules.hs | 3 +-- ghcide/src/Development/IDE/Types/KnownTargets.hs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/ghcide/src/Development/IDE/Core/Rules.hs b/ghcide/src/Development/IDE/Core/Rules.hs index 1e050d57b1..41176e17c9 100644 --- a/ghcide/src/Development/IDE/Core/Rules.hs +++ b/ghcide/src/Development/IDE/Core/Rules.hs @@ -328,8 +328,7 @@ getLocatedImportsRule recorder = return $ if itExists then Just nfp' else Nothing | Just tt <- HM.lookup (TargetModule modName) targets = do -- reuse the existing NormalizedFilePath in order to maximize sharing - let ttmap = HM.mapWithKey const (HashSet.toMap tt) - nfp' = HM.lookupDefault nfp nfp ttmap + let nfp' = nfp itExists <- getFileExists nfp' return $ if itExists then Just nfp' else Nothing | otherwise = do diff --git a/ghcide/src/Development/IDE/Types/KnownTargets.hs b/ghcide/src/Development/IDE/Types/KnownTargets.hs index 6ae6d52ba3..dd5c549a01 100644 --- a/ghcide/src/Development/IDE/Types/KnownTargets.hs +++ b/ghcide/src/Development/IDE/Types/KnownTargets.hs @@ -21,7 +21,7 @@ import GHC.Generics -- | A mapping of module name to known files data KnownTargets = KnownTargets { targetMap :: !(HashMap Target (HashSet NormalizedFilePath)) - -- | 'normalisingMap' is a cached copy of `HMap.mapKey const targetMap` + -- | 'normalisingMap' is a cached copy of `HMap.mapWithKey const targetMap` -- -- At startup 'GetLocatedImports' is called on all known files. Say you have 10000 -- modules in your project then this leads to 10000 calls to 'GetLocatedImports'