@@ -111,6 +111,7 @@ documentSymbolForDecl (L (locA -> (RealSrcSpan l _)) (TyClD _ DataDecl { tcdLNam
111111 { _name = showRdrName n
112112 , _kind = SkConstructor
113113 , _selectionRange = realSrcSpanToRange l'
114+ #if MIN_VERSION_ghc(9,2,0)
114115 , _children = Just $ List $ childs
115116 }
116117 | con <- dd_cons
@@ -126,6 +127,14 @@ documentSymbolForDecl (L (locA -> (RealSrcSpan l _)) (TyClD _ DataDecl { tcdLNam
126127 , _kind = SkField
127128 }
128129 cvtFld _ = Nothing
130+ #else
131+ , _children = conArgRecordFields (con_args x)
132+ }
133+ | L (locA -> (RealSrcSpan l _ )) x <- dd_cons
134+ , L (locA -> (RealSrcSpan l' _)) n <- getConNames' x
135+ ]
136+ }
137+ where
129138 -- | Extract the record fields of a constructor
130139 conArgRecordFields (RecCon (L _ lcdfs)) = Just $ List
131140 [ (defDocumentSymbol l :: DocumentSymbol )
@@ -136,6 +145,7 @@ documentSymbolForDecl (L (locA -> (RealSrcSpan l _)) (TyClD _ DataDecl { tcdLNam
136145 , L (locA -> (RealSrcSpan l _)) n <- rdrNameFieldOcc . unLoc <$> cd_fld_names cdf
137146 ]
138147 conArgRecordFields _ = Nothing
148+ #endif
139149documentSymbolForDecl (L (locA -> (RealSrcSpan l _)) (TyClD _ SynDecl { tcdLName = L (locA -> (RealSrcSpan l' _)) n })) = Just
140150 (defDocumentSymbol l :: DocumentSymbol ) { _name = showRdrName n
141151 , _kind = SkTypeParameter
@@ -248,17 +258,14 @@ pprText = pack . showSDocUnsafe . ppr
248258-- the version of getConNames for ghc9 is restricted to only the renaming phase
249259#if !MIN_VERSION_ghc(9,2,0)
250260getConNames' :: ConDecl GhcPs -> [Located (IdP GhcPs )]
251- #else
252- getConNames' :: ConDecl GhcPs -> [XRec GhcPs (IdP GhcPs )]
253- #endif
254261getConNames' ConDeclH98 {con_name = name} = [name]
255262getConNames' ConDeclGADT {con_names = names} = names
256263#if !MIN_VERSION_ghc(8,10,0)
257264getConNames' (XConDecl NoExt ) = []
258265#elif !MIN_VERSION_ghc(9,0,0)
259266getConNames' (XConDecl x) = noExtCon x
260267#endif
261-
268+ #else
262269hsConDeclsBinders :: LConDecl GhcPs
263270 -> ([Located (IdP GhcPs )], [LFieldOcc GhcPs ])
264271 -- See hsLTyClDeclBinders for what this does
@@ -299,4 +306,4 @@ hsConDeclsBinders cons
299306 get_flds :: Located [LConDeclField GhcPs ]
300307 -> ([LFieldOcc GhcPs ])
301308 get_flds flds = concatMap (cd_fld_names . unLoc) (unLoc flds)
302-
309+ #endif
0 commit comments