File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
plugins/hls-rename-plugin/src/Ide/Plugin Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ import Ide.Types
5252import qualified Language.LSP.Protocol.Lens as L
5353import Language.LSP.Protocol.Message
5454import Language.LSP.Protocol.Types
55+ import Data.List
5556
5657instance Hashable (Mod a ) where hash n = hash (unMod n)
5758
@@ -197,19 +198,22 @@ refsAtName state nfp name = do
197198 ast <- handleGetHieAst state nfp
198199 dbRefs <- case nameModule_maybe name of
199200 Nothing -> pure []
200- Just mod -> liftIO $ mapMaybe rowToLoc <$> withHieDb (\ hieDb ->
201+ Just mod -> liftIO $ mapMaybe rowToLoc <$> withHieDb (\ hieDb -> do
201202 -- GHC inserts `Use`s of record constructor everywhere where its record selectors are used,
202203 -- which leads to fields being renamed whenever corresponding constructor is renamed.
203204 -- see https://github.com/haskell/haskell-language-server/issues/2915
204205 -- To work around this, we filter out compiler-generated references.
205- filter ( \ (refRow HieDb. :. _) -> not $ refIsGenerated refRow) <$>
206- findReferences
206+
207+ xs <- findReferences
207208 hieDb
208209 True
209210 (nameOccName name)
210211 (Just $ moduleName mod )
211212 (Just $ moduleUnit mod )
212213 [fromNormalizedFilePath nfp]
214+ let (gen,notGen) = partition (\ (refRow HieDb. :. _) -> refIsGenerated refRow) xs
215+ putStrLn $ " Found " ++ show (length xs) ++ " references in HieDb: " ++ show (length xs) ++ " , of which " ++ show (length gen) ++ " are generated"
216+ pure notGen
213217 )
214218 pure $ nameLocs name ast ++ dbRefs
215219
You can’t perform that action at this time.
0 commit comments