packages feed

ghc-tags 1.4 → 1.5

raw patch · 4 files changed

+23/−12 lines, 4 files

Files

CHANGELOG.md view
@@ -1,3 +1,7 @@+# ghc-tags-1.5 (2022-05-15)+* Handle errors more gracefully.+* Enable `CApiFFI` by default.+ # ghc-tags-1.4 (2022-02-28) * Add support for GHC 9.2. * Require aeson >= 2.0.
ghc-tags.cabal view
@@ -1,6 +1,6 @@ cabal-version:       2.4 name:                ghc-tags-version:             1.4+version:             1.5 synopsis:            Utility for generating ctags and etags with GHC API. description:         Utility for generating etags (Emacs) and ctags (Vim and other                      editors) with GHC API for efficient project navigation.@@ -14,7 +14,7 @@                      README.md homepage:            https://github.com/arybczak/ghc-tags bug-reports:         https://github.com/arybczak/ghc-tags/issues-tested-with:         GHC ==8.10.7 || ==9.0.2 || ==9.2.1+tested-with:         GHC ==8.10.7 || ==9.0.2 || ==9.2.2  source-repository head   type:     git
src/GhcTags/Config/Project.hs view
@@ -38,6 +38,7 @@   , pcLanguage     = Haskell2010   , pcExtensions   = [ BangPatterns                      , BlockArguments+                     , CApiFFI                      , ExplicitForAll                      , ExplicitNamespaces                      , GADTSyntax
src/Main.hs view
@@ -79,15 +79,16 @@             paths <- map (path </>) <$> listDirectory path             processFiles paths           False -> F.forM_ (takeExtension path `lookup` haskellExts) $ \hsType -> do-            -- Source files are scanned and updated only if their mtime changed or-            -- it's not recorded.-            time <- getModificationTime path-            updateTags <- withMVar (wdTimes wd) $ \times -> pure $-              case TagFileName (T.pack path) `Map.lookup` times of-                Just (Updated _ oldTime) -> oldTime < time-                Nothing                  -> True-            when updateTags $ do-              atomically . writeTBQueue (wdQueue wd) $ Just (path, hsType, time)+            showIOError $ do+              -- Source files are scanned and updated only if their mtime changed or+              -- it's not recorded.+              time <- getModificationTime path+              updateTags <- withMVar (wdTimes wd) $ \times -> pure $+                case TagFileName (T.pack path) `Map.lookup` times of+                  Just (Updated _ oldTime) -> oldTime < time+                  Nothing                  -> True+              when updateTags $ do+                atomically . writeTBQueue (wdQueue wd) $ Just (path, hsType, time)       where         haskellExts = [ (".hs",      HsFile)                       , (".hs-boot", HsBootFile)@@ -100,6 +101,9 @@     terminateWorkers = atomically $ do       replicateM_ threads $ writeTBQueue (wdQueue wd) Nothing +    showIOError m = m `catch` \(e::IOError) -> do+      putStrLn $ "Error: " ++ show e+     -- Extract tags from a given file and update the TagMap.     worker :: IO ()     worker = runGhc $ do@@ -107,7 +111,9 @@       env <- getSession       liftIO . fix $ \loop -> atomically (readTBQueue $ wdQueue wd) >>= \case         Nothing                    -> pure ()-        Just (file, hsType, mtime) -> processFile env file hsType mtime >> loop+        Just (file, hsType, mtime) -> do+          showIOError $ processFile env file hsType mtime+          loop       where         processFile :: HscEnv -> FilePath -> HsFileType -> UTCTime -> IO ()         processFile env rawFile hsType mtime = withHsFile rawFile hsType $ \hsFile -> do