diff --git a/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/CodeLens.hs b/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/CodeLens.hs index 70d7c7d130a..f677a8febc6 100644 --- a/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/CodeLens.hs +++ b/plugins/hls-eval-plugin/src/Ide/Plugin/Eval/CodeLens.hs @@ -76,17 +76,17 @@ import GHC (ClsInst, parseName, pprFamInst, pprInstance, setTargets, typeKind) -#if MIN_VERSION_ghc(9,2,0) -import GHC (Fixity) -#endif + + + import qualified GHC.LanguageExtensions.Type as LangExt (Extension (..)) import Development.IDE.Core.FileStore (setSomethingModified) import Development.IDE.Types.Shake (toKey) import Ide.Plugin.Config (Config) -#if MIN_VERSION_ghc(9,2,0) -import GHC.Types.SrcLoc (UnhelpfulSpanReason (UnhelpfulInteractive)) -#endif + + + import Ide.Plugin.Eval.Code (Statement, asStatements, evalSetup, myExecStmt, propSetup, resultRange, @@ -110,13 +110,13 @@ import Language.LSP.Types hiding import Language.LSP.Types.Lens (end, line) import Language.LSP.VFS (virtualFileText) -#if MIN_VERSION_ghc(9,2,0) -#elif MIN_VERSION_ghc(9,0,0) -import GHC.Driver.Session (unitDatabases, unitState) -import GHC.Types.SrcLoc (UnhelpfulSpanReason (UnhelpfulInteractive)) -#else + + + + + import DynFlags -#endif + {- | Code Lens provider @@ -251,15 +251,15 @@ runEvalCmd plId st EvalParams{..} = . flip xopt_unset LangExt.MonomorphismRestriction $ idflags setInteractiveDynFlags $ df' -#if MIN_VERSION_ghc(9,0,0) - { - packageFlags = - packageFlags - df - , useColor = Never - , canUseColor = False - } -#else + + + + + + + + + { pkgState = pkgState df @@ -272,7 +272,7 @@ runEvalCmd plId st EvalParams{..} = , useColor = Never , canUseColor = False } -#endif + -- Load the module with its current content (as the saved module might not be up to date) -- BUG: this fails for files that requires preprocessors (e.g. CPP) for ghc < 8.8 @@ -358,8 +358,9 @@ runTests EvalConfig{..} e@(_st, _) tests = do dbg "TEST RESULTS" rs let checkedResult = testCheck eval_cfg_diff (section, test) rs + let resultLines = concatMap T.lines checkedResult - let edit = asEdit (sectionFormat section) test (map pad checkedResult) + let edit = asEdit (sectionFormat section) test (map pad resultLines) dbg "TEST EDIT" edit return edit @@ -511,11 +512,11 @@ evals mark_exception (st, fp) df stmts = do void $ runDecls stmt return Nothing pf = initParserOpts df -#if !MIN_VERSION_ghc(9,0,0) + unhelpfulReason = "" -#else - unhelpfulReason = UnhelpfulInteractive -#endif + + + exec stmt l = let opts = execOptions{execSourceFile = fp, execLineNumber = l} in myExecStmt stmt opts @@ -690,9 +691,9 @@ doTypeCmd dflags arg = do parseExprMode :: Text -> (TcRnExprMode, T.Text) parseExprMode rawArg = case T.break isSpace rawArg of -#if !MIN_VERSION_ghc(9,2,0) + ("+v", rest) -> (TM_NoInst, T.strip rest) -#endif + ("+d", rest) -> (TM_Default, T.strip rest) _ -> (TM_Inst, rawArg)