Skip to content

Commit f81a6b6

Browse files
committed
fix: add log when using git
1 parent b38f4d5 commit f81a6b6

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

ghcide/src/Development/IDE/Main.hs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ data Log
143143
| LogSession Session.Log
144144
| LogPluginHLS PluginHLS.Log
145145
| LogRules Rules.Log
146+
| LogMsg T.Text
146147
deriving Show
147148

148149
instance Pretty Log where
@@ -166,6 +167,7 @@ instance Pretty Log where
166167
LogSession msg -> pretty msg
167168
LogPluginHLS msg -> pretty msg
168169
LogRules msg -> pretty msg
170+
LogMsg msg -> pretty msg
169171

170172
data Command
171173
= Check [FilePath] -- ^ Typecheck some paths and print diagnostics. Exit code is the number of failures
@@ -385,7 +387,7 @@ defaultMain recorder Arguments{..} = withHeapStats (cmapWithPrio LogHeapStats re
385387
putStrLn "Report bugs at https://github.com/haskell/haskell-language-server/issues"
386388

387389
putStrLn $ "\nStep 1/4: Finding files to test in " ++ dir
388-
files <- expandFiles (argFiles ++ ["." | null argFiles])
390+
files <- expandFiles recorder (argFiles ++ ["." | null argFiles])
389391
-- LSP works with absolute file paths, so try and behave similarly
390392
absoluteFiles <- nubOrd <$> mapM IO.canonicalizePath files
391393
putStrLn $ "Found " ++ show (length absoluteFiles) ++ " files"
@@ -450,8 +452,8 @@ defaultMain recorder Arguments{..} = withHeapStats (cmapWithPrio LogHeapStats re
450452
-- | List the haskell files given some paths
451453
--
452454
-- It will rely on git if possible to filter-out ignored files.
453-
expandFiles :: [FilePath] -> IO [FilePath]
454-
expandFiles paths = do
455+
expandFiles :: Recorder (WithPriority Log) -> [FilePath] -> IO [FilePath]
456+
expandFiles recorder paths = do
455457
let haskellFind x =
456458
let recurse "." = True
457459
recurse y | "." `isPrefixOf` takeFileName y = False -- skip .git etc
@@ -464,6 +466,7 @@ expandFiles paths = do
464466
Just (ExitSuccess, gitStdout, _) -> Just gitStdout
465467
_ -> Nothing
466468
mHasGit <- git ["status"]
469+
when (isJust mHasGit) $ logWith recorder Info $ LogSession "Using git to list file, relying on .gitignore"
467470
let findFiles =
468471
case mHasGit of
469472
Just _ -> \path -> do
@@ -478,6 +481,7 @@ expandFiles paths = do
478481
Nothing -> haskellFind path
479482
Just files -> pure files
480483
_ -> haskellFind
484+
481485
flip concatMapM paths $ \x -> do
482486
b <- IO.doesFileExist x
483487
if b

0 commit comments

Comments
 (0)