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
52
52
import qualified Language.LSP.Protocol.Lens as L
53
53
import Language.LSP.Protocol.Message
54
54
import Language.LSP.Protocol.Types
55
+ import Data.List
55
56
56
57
instance Hashable (Mod a ) where hash n = hash (unMod n)
57
58
@@ -197,19 +198,22 @@ refsAtName state nfp name = do
197
198
ast <- handleGetHieAst state nfp
198
199
dbRefs <- case nameModule_maybe name of
199
200
Nothing -> pure []
200
- Just mod -> liftIO $ mapMaybe rowToLoc <$> withHieDb (\ hieDb ->
201
+ Just mod -> liftIO $ mapMaybe rowToLoc <$> withHieDb (\ hieDb -> do
201
202
-- GHC inserts `Use`s of record constructor everywhere where its record selectors are used,
202
203
-- which leads to fields being renamed whenever corresponding constructor is renamed.
203
204
-- see https://github.com/haskell/haskell-language-server/issues/2915
204
205
-- To work around this, we filter out compiler-generated references.
205
- filter ( \ (refRow HieDb. :. _) -> not $ refIsGenerated refRow) <$>
206
- findReferences
206
+
207
+ xs <- findReferences
207
208
hieDb
208
209
True
209
210
(nameOccName name)
210
211
(Just $ moduleName mod )
211
212
(Just $ moduleUnit mod )
212
213
[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
213
217
)
214
218
pure $ nameLocs name ast ++ dbRefs
215
219
You can’t perform that action at this time.
0 commit comments