File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
ghcide/src/Development/IDE/Core Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -631,6 +631,7 @@ getModuleGraphRule recorder = defineEarlyCutOffNoFile (cmapWithPrio LogShake rec
631
631
dependencyInfoForFiles (HashSet. toList fs)
632
632
633
633
{-# NOINLINE cacheVar #-}
634
+ -- TODO: this should not use unsaferPerformIO
634
635
cacheVar = unsafePerformIO (newTVarIO mempty )
635
636
636
637
getModulesPathsRule :: Recorder (WithPriority Log ) -> Rules ()
@@ -656,7 +657,10 @@ getModulesPathsRule recorder = defineEarlyCutoff (cmapWithPrio LogShake recorder
656
657
657
658
-- TODO: we are taking/droping extension, this could be factorized to save a few cpu cycles ;)
658
659
-- TODO: do acceptedextensions needs to be a set ? or a vector?
659
- modules <- fmap (\ path -> (toModule path, toNormalizedFilePath' path)) . filter (\ y -> takeExtension y `elem` acceptedExtensions) <$> liftIO (listFilesInside predicate dir)
660
+ -- If the directory is empty, we return an empty list of modules
661
+ -- using 'catch' instead of an exception which would kill the LSP
662
+ modules <- (fmap (\ path -> (toModule path, toNormalizedFilePath' path)) . filter (\ y -> takeExtension y `elem` acceptedExtensions) <$> liftIO (listFilesInside predicate dir))
663
+ `catch` (\ (_ :: IOException ) -> pure [] )
660
664
let isSourceModule (_, path) = " -boot" `isSuffixOf` fromNormalizedFilePath path
661
665
let (sourceModules, notSourceModules) = partition isSourceModule modules
662
666
pure $ (Map. fromList notSourceModules, Map. fromList sourceModules)
You can’t perform that action at this time.
0 commit comments