@@ -111,6 +111,7 @@ documentSymbolForDecl (L (locA -> (RealSrcSpan l _)) (TyClD _ DataDecl { tcdLNam
111
111
{ _name = showRdrName n
112
112
, _kind = SkConstructor
113
113
, _selectionRange = realSrcSpanToRange l'
114
+ #if MIN_VERSION_ghc(9,2,0)
114
115
, _children = Just $ List $ childs
115
116
}
116
117
| con <- dd_cons
@@ -126,6 +127,14 @@ documentSymbolForDecl (L (locA -> (RealSrcSpan l _)) (TyClD _ DataDecl { tcdLNam
126
127
, _kind = SkField
127
128
}
128
129
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
129
138
-- | Extract the record fields of a constructor
130
139
conArgRecordFields (RecCon (L _ lcdfs)) = Just $ List
131
140
[ (defDocumentSymbol l :: DocumentSymbol )
@@ -136,6 +145,7 @@ documentSymbolForDecl (L (locA -> (RealSrcSpan l _)) (TyClD _ DataDecl { tcdLNam
136
145
, L (locA -> (RealSrcSpan l _)) n <- rdrNameFieldOcc . unLoc <$> cd_fld_names cdf
137
146
]
138
147
conArgRecordFields _ = Nothing
148
+ #endif
139
149
documentSymbolForDecl (L (locA -> (RealSrcSpan l _)) (TyClD _ SynDecl { tcdLName = L (locA -> (RealSrcSpan l' _)) n })) = Just
140
150
(defDocumentSymbol l :: DocumentSymbol ) { _name = showRdrName n
141
151
, _kind = SkTypeParameter
@@ -248,17 +258,14 @@ pprText = pack . showSDocUnsafe . ppr
248
258
-- the version of getConNames for ghc9 is restricted to only the renaming phase
249
259
#if !MIN_VERSION_ghc(9,2,0)
250
260
getConNames' :: ConDecl GhcPs -> [Located (IdP GhcPs )]
251
- #else
252
- getConNames' :: ConDecl GhcPs -> [XRec GhcPs (IdP GhcPs )]
253
- #endif
254
261
getConNames' ConDeclH98 {con_name = name} = [name]
255
262
getConNames' ConDeclGADT {con_names = names} = names
256
263
#if !MIN_VERSION_ghc(8,10,0)
257
264
getConNames' (XConDecl NoExt ) = []
258
265
#elif !MIN_VERSION_ghc(9,0,0)
259
266
getConNames' (XConDecl x) = noExtCon x
260
267
#endif
261
-
268
+ #else
262
269
hsConDeclsBinders :: LConDecl GhcPs
263
270
-> ([Located (IdP GhcPs )], [LFieldOcc GhcPs ])
264
271
-- See hsLTyClDeclBinders for what this does
@@ -299,4 +306,4 @@ hsConDeclsBinders cons
299
306
get_flds :: Located [LConDeclField GhcPs ]
300
307
-> ([LFieldOcc GhcPs ])
301
308
get_flds flds = concatMap (cd_fld_names . unLoc) (unLoc flds)
302
-
309
+ #endif
0 commit comments