@@ -36,6 +36,7 @@ test = testGroup "explicit-fields"
36
36
, mkTestNoAction " Puns" " Puns" 12 10 12 31
37
37
, mkTestNoAction " Infix" " Infix" 11 11 11 31
38
38
, mkTestNoAction " Prefix" " Prefix" 10 11 10 28
39
+ , mkTest " PolymorphicRecordConstruction" " PolymorphicRecordConstruction" 15 5 15 15
39
40
]
40
41
, testGroup " inlay hints"
41
42
[ mkInlayHintsTest " Construction" Nothing 16 $ \ ih -> do
@@ -212,6 +213,31 @@ test = testGroup "explicit-fields"
212
213
, _tooltip = Just $ InL " Expand record wildcard"
213
214
, _paddingLeft = Just True
214
215
}]
216
+ , mkInlayHintsTest " PolymorphicRecordConstruction" Nothing 15 $ \ ih -> do
217
+ let mkLabelPart' = mkLabelPartOffsetLengthSub1 " PolymorphicRecordConstruction"
218
+ foo <- mkLabelPart' 5 4 " foo="
219
+ bar <- mkLabelPart' 6 4 " bar="
220
+ baz <- mkLabelPart' 7 4 " baz="
221
+ (@?=) ih
222
+ [ defInlayHint { _position = Position 15 11
223
+ , _label = InR [ foo ]
224
+ , _textEdits = Just [ mkLineTextEdit " MyRec { foo = a, bar = b, baz = c }" 15 5 16 ]
225
+ , _tooltip = Just $ InL " Expand positional record"
226
+ , _paddingLeft = Nothing
227
+ }
228
+ , defInlayHint { _position = Position 15 13
229
+ , _label = InR [ bar ]
230
+ , _textEdits = Just [ mkLineTextEdit " MyRec { foo = a, bar = b, baz = c }" 15 5 16 ]
231
+ , _tooltip = Just $ InL " Expand positional record"
232
+ , _paddingLeft = Nothing
233
+ }
234
+ , defInlayHint { _position = Position 15 15
235
+ , _label = InR [ baz ]
236
+ , _textEdits = Just [ mkLineTextEdit " MyRec { foo = a, bar = b, baz = c }" 15 5 16 ]
237
+ , _tooltip = Just $ InL " Expand positional record"
238
+ , _paddingLeft = Nothing
239
+ }
240
+ ]
215
241
]
216
242
]
217
243
@@ -285,10 +311,10 @@ mkLabelPart offset fp line start value = do
285
311
uri = canonicalizeUri $ toUri (testDataDir </> (fp ++ " .hs" ))
286
312
location uri line char = Location uri (Range (Position line char) (Position line (char + offset value)))
287
313
288
- mkLabelPartOffsetLength :: FilePath -> UInt -> UInt -> Text -> IO InlayHintLabelPart
314
+ mkLabelPartOffsetLength :: FilePath -> UInt -> UInt -> Text -> IO InlayHintLabelPart
289
315
mkLabelPartOffsetLength = mkLabelPart (fromIntegral . T. length )
290
316
291
- mkLabelPartOffsetLengthSub1 :: FilePath -> UInt -> UInt -> Text -> IO InlayHintLabelPart
317
+ mkLabelPartOffsetLengthSub1 :: FilePath -> UInt -> UInt -> Text -> IO InlayHintLabelPart
292
318
mkLabelPartOffsetLengthSub1 = mkLabelPart (fromIntegral . subtract 1 . T. length )
293
319
294
320
commaPart :: InlayHintLabelPart
0 commit comments