@@ -35,7 +35,8 @@ import Data.Ord (Down (Down))
35
35
import qualified Data.Set as Set
36
36
import Development.IDE.Core.Compile
37
37
import Development.IDE.Core.PositionMapping
38
- import Development.IDE.GHC.Compat as GHC hiding (ppr )
38
+ import Development.IDE.GHC.Compat hiding (ppr )
39
+ import qualified Development.IDE.GHC.Compat as GHC
39
40
import Development.IDE.GHC.Compat.Util
40
41
import Development.IDE.GHC.Error
41
42
import Development.IDE.GHC.Util
@@ -46,6 +47,15 @@ import Development.IDE.Spans.LocalBindings
46
47
import Development.IDE.Types.Exports
47
48
import Development.IDE.Types.HscEnvEq
48
49
import Development.IDE.Types.Options
50
+
51
+ #if MIN_VERSION_ghc(9,2,0)
52
+ import GHC.Plugins (Depth (AllTheWay ),
53
+ defaultSDocContext ,
54
+ mkUserStyle ,
55
+ neverQualify ,
56
+ renderWithContext ,
57
+ sdocStyle )
58
+ #endif
49
59
import Ide.PluginUtils (mkLspCommand )
50
60
import Ide.Types (CommandId (.. ),
51
61
PluginId )
@@ -254,10 +264,16 @@ mkNameCompItem doc thingParent origName provenance thingType isInfix docs !imp =
254
264
(TyVarTy _) -> noParensSnippet
255
265
(LitTy _) -> noParensSnippet
256
266
(TyConApp _ [] ) -> noParensSnippet
257
- _ -> snippetText i (" (" <> showGhc t <> " )" )
267
+ _ -> snippetText i (" (" <> showForSnippet t <> " )" )
258
268
where
259
- noParensSnippet = snippetText i (showGhc t)
269
+ noParensSnippet = snippetText i (showForSnippet t)
260
270
snippetText i t = " ${" <> T. pack (show i) <> " :" <> t <> " }"
271
+ #if MIN_VERSION_ghc(9,2,0)
272
+ showForSnippet x = T. pack $ renderWithContext ctxt $ GHC. ppr x -- FIXme
273
+ ctxt = defaultSDocContext{sdocStyle = mkUserStyle neverQualify AllTheWay }
274
+ #else
275
+ showForSnippet x = showGhc x
276
+ #endif
261
277
getArgs :: Type -> [Type ]
262
278
getArgs t
263
279
| isPredTy t = []
@@ -277,6 +293,7 @@ mkNameCompItem doc thingParent origName provenance thingType isInfix docs !imp =
277
293
#endif
278
294
| otherwise = []
279
295
296
+
280
297
mkModCompl :: T. Text -> CompletionItem
281
298
mkModCompl label =
282
299
CompletionItem label (Just CiModule ) Nothing Nothing
0 commit comments