@@ -41,17 +41,10 @@ import Data.String (IsString (fromString))
4141import Data.Text (Text )
4242import qualified Data.Text as T
4343import Data.Time (getCurrentTime )
44- import Development.IDE.Core.Rules (runAction )
45- import Development.IDE.Core.RuleTypes (GetModSummary (.. ),
46- GhcSession (.. ))
47- import Development.IDE.Core.Shake (use_ )
48- import Development.IDE.GHC.Util (evalGhcEnv , hscEnv ,
49- textToStringBuffer )
50- import Development.IDE.Types.Location (toNormalizedFilePath' ,
51- uriToFilePath' )
44+ import Development.IDE
5245import DynamicLoading (initializePlugins )
5346import DynFlags (targetPlatform )
54- import GHC (Ghc , TcRnExprMode (.. ), DynFlags , ExecResult (.. ), GeneralFlag (Opt_IgnoreHpcChanges , Opt_IgnoreOptimChanges , Opt_ImplicitImportQualified ),
47+ import Development.IDE. GHC.Compat (Ghc , TcRnExprMode (.. ), DynFlags , ExecResult (.. ), GeneralFlag (Opt_IgnoreHpcChanges , Opt_IgnoreOptimChanges , Opt_ImplicitImportQualified ),
5548 GhcLink (LinkInMemory ),
5649 GhcMode (CompManager ),
5750 HscTarget (HscInterpreted ),
@@ -179,25 +172,10 @@ runEvalCmd lsp state EvalParams {..} = response' $ do
179172 contents <- liftIO $ getVirtualFileFunc lsp $ toNormalizedUri _uri
180173 text <- handleMaybe " contents" $ virtualFileText <$> contents
181174
182- {- Note: GhcSessionDeps
183-
184- Depending on GhcSession means we do need to reload all the module
185- dependencies in the GHC session(from interface files, hopefully).
186-
187- The GhcSessionDeps dependency would allow us to reuse a GHC session preloaded
188- with all the dependencies. Unfortunately, the ModSummary objects that
189- GhcSessionDeps puts in the GHC session are not suitable for reuse since they
190- clear out the timestamps; this is done to avoid internal ghcide bugs and
191- can probably be relaxed so that plugins like Eval can reuse them. Once that's
192- done, we want to switch back to GhcSessionDeps:
193-
194- -- https://github.com/digital-asset/ghcide/pull/694
195-
196- -}
197175 session <-
198176 liftIO $
199177 runAction " runEvalCmd.ghcSession" state $
200- use_ GhcSession $ -- See the note on GhcSessionDeps
178+ use_ GhcSessionDeps $
201179 toNormalizedFilePath' $
202180 fp
203181
@@ -316,15 +294,15 @@ evalGhciLikeCmd cmd arg = do
316294 (ty, kind) <- typeKind True $ T. unpack input
317295 pure
318296 $ Just
319- $ T. unlines
297+ $ T. unlines
320298 $ map (" -- " <> )
321299 [ input <> " :: " <> tppr kind
322300 , " = " <> tppr ty
323- ]
301+ ]
324302 " type" -> do
325303 let (emod, expr) = parseExprMode arg
326304 ty <- exprType emod $ T. unpack expr
327- pure $ Just $
305+ pure $ Just $
328306 " -- " <> expr <> " :: " <> tppr ty <> " \n "
329307 _ -> E. throw $ GhciLikeCmdNotImplemented cmd arg
330308
@@ -346,7 +324,7 @@ instance Show GhciLikeCmdException where
346324 showsPrec _ GhciLikeCmdNotImplemented {.. } =
347325 showString " unknown command '" .
348326 showString (T. unpack ghciCmdName) . showChar ' \' '
349-
327+
350328instance E. Exception GhciLikeCmdException
351329
352330parseGhciLikeCmd :: Text -> Maybe (Text , Text )
0 commit comments