Skip to content

Commit 06fcd81

Browse files
committed
fix: remove unused log mecanism
1 parent 4588a7e commit 06fcd81

File tree

1 file changed

+3
-28
lines changed

1 file changed

+3
-28
lines changed

plugins/hls-eval-plugin/src/Ide/Plugin/Eval/CodeLens.hs

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ import GHC (ClsInst,
7676
pprInstance, setTargets,
7777
typeKind)
7878
#if MIN_VERSION_ghc(9,2,0)
79-
import GHC (Fixity, pushLogHookM)
79+
import GHC (Fixity)
8080
#else
8181
import GHC (setLogAction)
8282
#endif
@@ -110,9 +110,6 @@ import Language.LSP.Types hiding
110110
SemanticTokenRelative (length))
111111
import Language.LSP.Types.Lens (end, line)
112112
import Language.LSP.VFS (virtualFileText)
113-
import System.FilePath (takeFileName)
114-
import System.IO (hClose)
115-
import UnliftIO.Temporary (withSystemTempFile)
116113

117114
#if MIN_VERSION_ghc(9,2,0)
118115
#elif MIN_VERSION_ghc(9,0,0)
@@ -227,7 +224,7 @@ runEvalCmd plId st EvalParams{..} =
227224
(Just (textToStringBuffer mdlText, now))
228225

229226
-- Setup environment for evaluation
230-
hscEnv' <- ExceptT $ fmap join $ withSystemTempFile (takeFileName fp) $ \logFilename logHandle -> liftIO . gStrictTry . evalGhcEnv session $ do
227+
hscEnv' <- ExceptT $ fmap join $ liftIO . gStrictTry . evalGhcEnv session $ do
231228
env <- getSession
232229

233230
-- Install the module pragmas and options
@@ -278,27 +275,6 @@ runEvalCmd plId st EvalParams{..} =
278275
}
279276
#endif
280277

281-
-- set up a custom log action
282-
#if MIN_VERSION_ghc(9,2,0)
283-
-- NOTE: I removed that, it was breaking the eval plugin, sometimes
284-
-- I don't know why, I don't even understand what is the purpose of theses lines.
285-
-- I just copied them from the previous version and tried to
286-
-- adapt them to the new GHC 9.2 API.
287-
--
288-
-- But tests are fine without this.
289-
-- So, what have I missed?
290-
--
291-
-- pushLogHookM . const $ \_df _wr _sev _span _doc ->
292-
-- defaultLogActionHPutStrDoc _df False logHandle _doc
293-
-- TODO: check the True
294-
#elif MIN_VERSION_ghc(9,0,0)
295-
setLogAction $ \_df _wr _sev _span _doc ->
296-
defaultLogActionHPutStrDoc _df logHandle _doc
297-
#else
298-
setLogAction $ \_df _wr _sev _span _style _doc ->
299-
defaultLogActionHPutStrDoc _df logHandle _doc _style
300-
#endif
301-
302278
-- Load the module with its current content (as the saved module might not be up to date)
303279
-- BUG: this fails for files that requires preprocessors (e.g. CPP) for ghc < 8.8
304280
-- see https://gitlab.haskell.org/ghc/ghc/-/issues/17066
@@ -311,8 +287,7 @@ runEvalCmd plId st EvalParams{..} =
311287
dbg "LOAD RESULT" $ asS loadResult
312288
case loadResult of
313289
Failed -> liftIO $ do
314-
hClose logHandle
315-
err <- readFile logFilename
290+
let err = ""
316291
dbg "load ERR" err
317292
return $ Left err
318293
Succeeded -> do

0 commit comments

Comments
 (0)