@@ -41,17 +41,10 @@ import Data.String (IsString (fromString))
41
41
import Data.Text (Text )
42
42
import qualified Data.Text as T
43
43
import 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
52
45
import DynamicLoading (initializePlugins )
53
46
import 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 ),
55
48
GhcLink (LinkInMemory ),
56
49
GhcMode (CompManager ),
57
50
HscTarget (HscInterpreted ),
@@ -179,25 +172,10 @@ runEvalCmd lsp state EvalParams {..} = response' $ do
179
172
contents <- liftIO $ getVirtualFileFunc lsp $ toNormalizedUri _uri
180
173
text <- handleMaybe " contents" $ virtualFileText <$> contents
181
174
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
- -}
197
175
session <-
198
176
liftIO $
199
177
runAction " runEvalCmd.ghcSession" state $
200
- use_ GhcSession $ -- See the note on GhcSessionDeps
178
+ use_ GhcSessionDeps $
201
179
toNormalizedFilePath' $
202
180
fp
203
181
@@ -316,15 +294,15 @@ evalGhciLikeCmd cmd arg = do
316
294
(ty, kind) <- typeKind True $ T. unpack input
317
295
pure
318
296
$ Just
319
- $ T. unlines
297
+ $ T. unlines
320
298
$ map (" -- " <> )
321
299
[ input <> " :: " <> tppr kind
322
300
, " = " <> tppr ty
323
- ]
301
+ ]
324
302
" type" -> do
325
303
let (emod, expr) = parseExprMode arg
326
304
ty <- exprType emod $ T. unpack expr
327
- pure $ Just $
305
+ pure $ Just $
328
306
" -- " <> expr <> " :: " <> tppr ty <> " \n "
329
307
_ -> E. throw $ GhciLikeCmdNotImplemented cmd arg
330
308
@@ -346,7 +324,7 @@ instance Show GhciLikeCmdException where
346
324
showsPrec _ GhciLikeCmdNotImplemented {.. } =
347
325
showString " unknown command '" .
348
326
showString (T. unpack ghciCmdName) . showChar ' \' '
349
-
327
+
350
328
instance E. Exception GhciLikeCmdException
351
329
352
330
parseGhciLikeCmd :: Text -> Maybe (Text , Text )
0 commit comments