-
-
Notifications
You must be signed in to change notification settings - Fork 389
/
Copy pathMain.hs
547 lines (526 loc) · 22.9 KB
/
Main.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TupleSections #-}
module Main (main) where
import Control.Lens (set, (^.))
import Control.Monad.Extra
import Data.Aeson
import Data.Functor ((<&>))
import Data.List (sort)
import qualified Data.Map as M
import qualified Data.Text as T
import Ide.Plugin.CallHierarchy
import qualified Language.LSP.Test as Test
import qualified Language.LSP.Types.Lens as L
import System.Directory.Extra
import System.FilePath
import qualified System.IO.Extra
import Test.Hls
import Test.Hls.Util (withCanonicalTempDir)
plugin :: PluginDescriptor IdeState
plugin = descriptor
main :: IO ()
main = defaultTestRunner $
testGroup "Call Hierarchy"
[ prepareCallHierarchyTests
, incomingCallsTests
, outgoingCallsTests
]
prepareCallHierarchyTests :: TestTree
prepareCallHierarchyTests =
testGroup
"Prepare Call Hierarchy"
[ testCase "variable" $ do
let contents = T.unlines ["a=3"]
range = mkRange 0 0 0 3
selRange = mkRange 0 0 0 1
expected = mkCallHierarchyItemV "a" SkFunction range selRange
oneCaseWithCreate contents 0 0 expected
, testCase "function" $ do
let contents = T.unlines ["a=(+)"]
range = mkRange 0 0 0 5
selRange = mkRange 0 0 0 1
expected = mkCallHierarchyItemV "a" SkFunction range selRange
oneCaseWithCreate contents 0 0 expected
, testCase "datatype" $ do
let contents = T.unlines ["data A=A"]
range = mkRange 0 0 0 8
selRange = mkRange 0 5 0 6
expected = mkCallHierarchyItemT "A" SkStruct range selRange
oneCaseWithCreate contents 0 5 expected
, testCase "data constructor" $ do
let contents = T.unlines ["data A=A"]
range = mkRange 0 7 0 8
selRange = mkRange 0 7 0 8
expected = mkCallHierarchyItemC "A" SkConstructor range selRange
oneCaseWithCreate contents 0 7 expected
-- , testCase "record" $ do
-- let contents = T.unlines ["data A=A{a::Int}"]
-- range = mkRange 0 9 0 10
-- selRange = mkRange 0 9 0 10
-- expected = mkCallHierarchyItemV "a" SkField range selRange
-- oneCaseWithCreate contents 0 9 expected
, testCase "type operator" $ do
let contents = T.unlines ["{-# LANGUAGE TypeOperators #-}", "type (><)=Maybe"]
range = mkRange 1 0 1 15
selRange = mkRange 1 5 1 9
expected = mkCallHierarchyItemT "><" SkTypeParameter range selRange
oneCaseWithCreate contents 1 5 expected
, testCase "type class" $ do
let contents = T.unlines ["class A a where a :: a -> Int"]
range = mkRange 0 0 0 29
selRange = mkRange 0 6 0 7
expected = mkCallHierarchyItemT "A" SkInterface range selRange
oneCaseWithCreate contents 0 6 expected
, testCase "type class method" $ do
let contents = T.unlines ["class A a where a :: a -> Int"]
range = mkRange 0 16 0 29
selRange = mkRange 0 16 0 17
expected = mkCallHierarchyItemV "a" SkMethod range selRange
oneCaseWithCreate contents 0 16 expected
, testCase "type class instance" $ do
let contents = T.unlines ["class A a where", "instance A () where"]
range = mkRange 1 9 1 10
selRange = mkRange 1 9 1 10
expected = mkCallHierarchyItemT "A" SkInterface range selRange
oneCaseWithCreate contents 1 9 expected
, testGroup "type family"
[ testCase "1" $ do
let contents = T.unlines ["{-# LANGUAGE TypeFamilies #-}", "type family A"]
range = mkRange 1 0 1 13
selRange = mkRange 1 12 1 13
expected = mkCallHierarchyItemT "A" SkFunction range selRange
oneCaseWithCreate contents 1 12 expected
, testCase "2" $ do
let contents = T.unlines ["{-# LANGUAGE TypeFamilies #-}", "type family A a"]
range = mkRange 1 0 1 15
selRange = mkRange 1 12 1 13
expected = mkCallHierarchyItemT "A" SkFunction range selRange
oneCaseWithCreate contents 1 12 expected
]
, testCase "type family instance" $ do
let contents = T.unlines
[ "{-# LANGUAGE TypeFamilies #-}"
, "type family A a"
, "type instance A () = ()"
]
range = mkRange 2 14 2 23
selRange = mkRange 2 14 2 15
expected = mkCallHierarchyItemT "A" SkInterface range selRange
oneCaseWithCreate contents 2 14 expected
, testGroup "data family"
[ testCase "1" $ do
let contents = T.unlines ["{-# LANGUAGE TypeFamilies #-}", "data family A"]
range = mkRange 1 0 1 11
selRange = mkRange 1 12 1 13
expected = mkCallHierarchyItemT "A" SkFunction range selRange
oneCaseWithCreate contents 1 12 expected
, testCase "2" $ do
let contents = T.unlines [ "{-# LANGUAGE TypeFamilies #-}" , "data family A a"]
range = mkRange 1 0 1 11
selRange = mkRange 1 12 1 13
expected = mkCallHierarchyItemT "A" SkFunction range selRange
oneCaseWithCreate contents 1 12 expected
]
, testCase "data family instance" $ do
let contents = T.unlines
[ "{-# LANGUAGE TypeFamilies #-}"
, "data family A a"
, "data instance A () = A()"
]
range = mkRange 2 14 2 24
selRange = mkRange 2 14 2 15
expected = mkCallHierarchyItemT "A" SkInterface range selRange
oneCaseWithCreate contents 2 14 expected
, testCase "pattern" $ do
let contents = T.unlines ["Just x = Just 3"]
range = mkRange 0 0 0 15
selRange = mkRange 0 5 0 6
expected = mkCallHierarchyItemV "x" SkFunction range selRange
oneCaseWithCreate contents 0 5 expected
, testCase "pattern with type signature" $ do
let contents = T.unlines ["{-# LANGUAGE ScopedTypeVariables #-}", "a :: () = ()"]
range = mkRange 1 0 1 12
selRange = mkRange 1 0 1 1
expected = mkCallHierarchyItemV "a" SkFunction range selRange
oneCaseWithCreate contents 1 0 expected
, testCase "type synonym" $ do
let contents = T.unlines ["type A=Bool"]
range = mkRange 0 0 0 11
selRange = mkRange 0 5 0 6
expected = mkCallHierarchyItemT "A" SkTypeParameter range selRange
oneCaseWithCreate contents 0 5 expected
, testCase "GADT" $ do
let contents = T.unlines
[ "{-# LANGUAGE GADTs #-}"
, "data A where A :: Int -> A"
]
range = mkRange 1 13 1 26
selRange = mkRange 1 13 1 14
expected = mkCallHierarchyItemC "A" SkConstructor range selRange
oneCaseWithCreate contents 1 13 expected
, testGroup "type signature"
[ knownBrokenForGhcVersions [GHC94] "type signature broken" $ testCase "next line" $ do
let contents = T.unlines ["a::Int", "a=3"]
range = mkRange 1 0 1 3
selRange = mkRange 1 0 1 1
expected = mkCallHierarchyItemV "a" SkFunction range selRange
oneCaseWithCreate contents 0 0 expected
, knownBrokenForGhcVersions [GHC94] "type signature broken" $ testCase "multi functions" $ do
let contents = T.unlines [ "a,b::Int", "a=3", "b=4"]
range = mkRange 2 0 2 3
selRange = mkRange 2 0 2 1
expected = mkCallHierarchyItemV "b" SkFunction range selRange
oneCaseWithCreate contents 0 2 expected
]
, testCase "multi pattern" $ do
let contents = T.unlines
[ "f (Just _) = ()"
, "f Nothing = ()"
]
range = mkRange 1 0 1 1
selRange = mkRange 1 0 1 1
expected = mkCallHierarchyItemV "f" SkFunction range selRange
oneCaseWithCreate contents 1 0 expected
]
incomingCallsTests :: TestTree
incomingCallsTests =
testGroup "Incoming Calls"
[ testGroup "single file"
[
testCase "xdata unavailable" $
runSessionWithServer plugin testDataDir $ do
doc <- createDoc "A.hs" "haskell" $ T.unlines ["a=3", "b=a"]
waitForKickDone
[item] <- Test.prepareCallHierarchy (mkPrepareCallHierarchyParam doc 1 0)
let expected = [CallHierarchyIncomingCall item (List [mkRange 1 2 1 3])]
Test.prepareCallHierarchy (mkPrepareCallHierarchyParam doc 0 0) >>=
\case
[item] -> do
let itemNoData = set L.xdata Nothing item
Test.incomingCalls (mkIncomingCallsParam itemNoData) >>=
\res -> liftIO $ sort expected @=? sort res
_ -> liftIO $ assertFailure "Not exactly one element"
closeDoc doc
, testCase "xdata available" $ do
let contents = T.unlines ["a=3","b=a"]
positions = [(1, 0)]
ranges = [mkRange 1 2 1 3]
incomingCallTestCase contents 0 1 positions ranges
, testGroup "data"
[ testCase "data type" $ do
let contents = T.unlines ["data A=A"]
positions = []
ranges = []
incomingCallTestCase contents 0 5 positions ranges
, testCase "data constructor" $ do
let contents = T.unlines ["data A=A"]
positions = [(0, 5)]
ranges = [mkRange 0 7 0 8]
incomingCallTestCase contents 0 7 positions ranges
-- , testCase "record" $ do
-- let contents = T.unlines ["data A=A{a::Int}"]
-- positions = [(0, 5), (0, 7)]
-- ranges = [mkRange 0 9 0 10, mkRange 0 9 0 10]
-- incomingCallTestCase contents 0 9 positions ranges
]
, testCase "function" $ do
let contents = T.unlines ["a=(+)"]
positions = [(0, 0)]
ranges = [mkRange 0 2 0 5]
incomingCallTestCase contents 0 3 positions ranges
, testCase "type operator" $ do
let contents = T.unlines
[ "{-# LANGUAGE TypeOperators #-}"
, "type (><)=Int"]
positions = [(1, 5)]
ranges = [mkRange 1 10 1 13]
incomingCallTestCase contents 1 10 positions ranges
, testGroup "type class"
[ testCase "type class method" $ do
let contents = T.unlines ["class A a where a :: a -> Int"]
positions = [(0, 6)]
ranges = [mkRange 0 16 0 17]
incomingCallTestCase contents 0 16 positions ranges
, testCase "type class instance" $ do
let contents = T.unlines
[ "class A a where a :: a -> Int"
, "instance A () where a = const 3"]
positions = [(0, 6)]
ranges = [mkRange 0 16 0 17]
incomingCallTestCase contents 1 20 positions ranges
, testCase "goto typeclass instance" $ do
let contents = T.unlines
[ "class F a where f :: a"
, "instance F Bool where f = x"
, "instance F Int where f = 3"
, "x = True"
]
positions = [(1, 22)]
ranges = [mkRange 1 26 1 27]
incomingCallTestCase contents 3 0 positions ranges
]
, testCase "type family instance" $ do
let contents = T.unlines
[ "{-# LANGUAGE TypeFamilies #-}"
, "type family A a"
, "type instance A Int = Char"
]
positions = [(2, 14)]
ranges = [mkRange 2 22 2 26]
incomingCallTestCase contents 2 22 positions ranges
, testCase "GADT" $ do
let contents = T.unlines
[ "{-# LANGUAGE GADTs #-}"
, "data A where B :: Int -> A"
]
positions = [(1, 5)]
ranges = [mkRange 1 13 1 14]
incomingCallTestCase contents 1 13 positions ranges
, testCase "multi pattern" $ do
let contents = T.unlines
[ "f 1 = 1"
, "f 2 = 2"
, "g = f"
]
positions = [(2, 0)]
ranges = [mkRange 2 4 2 5]
incomingCallTestCase contents 1 0 positions ranges
]
, testGroup "multi file"
[ testCase "1" $ do
let mp = M.fromList [
("A.hs", [ ((5, 0), mkRange 5 7 5 11)
, ((6, 0), mkRange 6 7 6 11)
, ((8, 0), mkRange 9 25 9 29)
]
)]
incomingCallMultiFileTestCase "A.hs" 4 0 mp
, testCase "2" $ do
let mp = M.fromList [
("A.hs", [ ((4, 0), mkRange 4 13 4 16)
, ((8, 0), mkRange 10 7 10 10)
]
)
, ("B.hs", [ ((4, 0), mkRange 4 8 4 11)])
]
incomingCallMultiFileTestCase "C.hs" 2 0 mp
]
]
outgoingCallsTests :: TestTree
outgoingCallsTests =
testGroup "Outgoing Calls"
[ testGroup "single file"
[
testCase "xdata unavailable" $ withCanonicalTempDir $ \dir ->
runSessionWithServer plugin dir $ do
doc <- createDoc "A.hs" "haskell" $ T.unlines ["a=3", "b=a"]
waitForKickDone
[item] <- Test.prepareCallHierarchy (mkPrepareCallHierarchyParam doc 0 1)
let expected = [CallHierarchyOutgoingCall item (List [mkRange 1 2 1 3])]
Test.prepareCallHierarchy (mkPrepareCallHierarchyParam doc 1 0) >>=
\case
[item] -> do
let itemNoData = set L.xdata Nothing item
Test.outgoingCalls (mkOutgoingCallsParam itemNoData) >>=
\res -> liftIO $ sort expected @=? sort res
_ -> liftIO $ assertFailure "Not exactly one element"
closeDoc doc
, testCase "xdata available" $ do
let contents = T.unlines ["a=3", "b=a"]
positions = [(0, 0)]
ranges = [mkRange 1 2 1 3]
outgoingCallTestCase contents 1 0 positions ranges
, testGroup "data"
[ testCase "data type" $ do
let contents = T.unlines ["data A=A"]
positions = [(0, 7)]
ranges = [mkRange 0 7 0 8]
outgoingCallTestCase contents 0 5 positions ranges
, testCase "data constructor" $ do
let contents = T.unlines ["data A=A"]
positions = []
ranges = []
outgoingCallTestCase contents 0 7 positions ranges
-- , testCase "record" $ do
-- let contents = T.unlines ["data A=A{a::Int}"]
-- positions = [(0, 7), (0, 9)]
-- ranges = [mkRange 0 7 0 8, mkRange 0 9 0 10]
-- outgoingCallTestCase contents 0 5 positions ranges
]
, testCase "function" $ do
let contents = T.unlines ["a=3", "b=4", "c=a+b"]
positions = [(0, 1), (1, 1)]
ranges = [mkRange 2 2 2 3, mkRange 2 4 2 5]
outgoingCallTestCase contents 2 0 positions ranges
, testCase "type synonym" $ do
let contents = T.unlines ["data A", "type B=A"]
positions = [(0, 5)]
ranges = [mkRange 1 7 1 8]
outgoingCallTestCase contents 1 5 positions ranges
, testCase "type class instance" $ do
let contents = T.unlines
[ "class A a where a :: a"
, "instance A () where a = ()"
]
positions = [(0, 16)]
ranges = [mkRange 0 16 0 17]
outgoingCallTestCase contents 1 9 positions ranges
, testCase "data family instance" $ do
let contents = T.unlines
[ "{-# LANGUAGE TypeFamilies #-}"
, "data family A a"
, "data instance A () = B"
]
positions = [(2, 21)]
ranges = [mkRange 2 21 2 22]
outgoingCallTestCase contents 1 12 positions ranges
, testCase "GADT" $ do
let contents = T.unlines ["{-# LANGUAGE GADTs #-}", "data A where B :: A"]
positions = [(1, 13)]
ranges = [mkRange 1 13 1 14]
outgoingCallTestCase contents 1 5 positions ranges
]
, testGroup "multi file"
[ testCase "1" $ do
let mp = M.fromList [
("A.hs", [ ((4, 0), mkRange 5 7 5 11)])
, ("B.hs", [ ((4, 0), mkRange 5 14 5 17)])
, ("C.hs", [ ((3, 0), mkRange 5 20 5 23)])
]
outgoingCallMultiFileTestCase "A.hs" 5 0 mp
, testCase "2" $ do
let mp = M.fromList [
("A.hs", [ ((4, 0), mkRange 9 25 9 29)
, ((5, 0), mkRange 10 25 10 29)
]
)
, ("B.hs", [ ((2, 9), mkRange 9 2 9 3)
, ((2, 13), mkRange 10 2 10 3)
, ((4, 0), mkRange 9 7 9 10)
, ((5, 0), mkRange 9 13 9 16)
, ((6, 0), mkRange 9 19 9 22)
]
)
, ("C.hs", [ ((2, 0), mkRange 10 7 10 10)
, ((3, 0), mkRange 10 13 10 16)
, ((4, 0), mkRange 10 19 10 22)
]
)
]
outgoingCallMultiFileTestCase "A.hs" 8 0 mp
]
]
deriving instance Ord CallHierarchyIncomingCall
deriving instance Ord CallHierarchyOutgoingCall
incomingCallTestCase :: T.Text -> Int -> Int -> [(Int, Int)] -> [Range] -> Assertion
incomingCallTestCase contents queryX queryY positions ranges = withCanonicalTempDir $ \dir ->
runSessionWithServer plugin dir $ do
doc <- createDoc "A.hs" "haskell" contents
waitForKickDone
items <- concatMapM (\((x, y), range) ->
Test.prepareCallHierarchy (mkPrepareCallHierarchyParam doc x y)
<&> map (, range)
)
(zip positions ranges)
let expected = map mkCallHierarchyIncomingCall items
-- liftIO delay
Test.prepareCallHierarchy (mkPrepareCallHierarchyParam doc queryX queryY) >>=
\case
[item] -> do
Test.incomingCalls (mkIncomingCallsParam item) >>=
\res -> liftIO $ sort expected @=? sort res
_ -> liftIO $ assertFailure "Not one element"
closeDoc doc
incomingCallMultiFileTestCase :: FilePath -> Int -> Int -> M.Map FilePath [((Int, Int), Range)] -> Assertion
incomingCallMultiFileTestCase filepath queryX queryY mp =
runSessionWithServer plugin testDataDir $ do
doc <- openDoc filepath "haskell"
waitForKickDone
items <- fmap concat $ sequence $ M.elems $ M.mapWithKey (\fp pr -> do
p <- openDoc fp "haskell"
waitForKickDone
concatMapM (\((x, y), range) ->
Test.prepareCallHierarchy (mkPrepareCallHierarchyParam p x y)
<&> map (, range)
) pr) mp
let expected = map mkCallHierarchyIncomingCall items
-- liftIO delay
Test.prepareCallHierarchy (mkPrepareCallHierarchyParam doc queryX queryY) >>=
\case
[item] -> do
Test.incomingCalls (mkIncomingCallsParam item) >>=
\res -> liftIO $ sort expected @=? sort res
_ -> liftIO $ assertFailure "Not one element"
closeDoc doc
outgoingCallTestCase :: T.Text -> Int -> Int -> [(Int, Int)] -> [Range] -> Assertion
outgoingCallTestCase contents queryX queryY positions ranges = withCanonicalTempDir $ \dir ->
runSessionWithServer plugin dir $ do
doc <- createDoc "A.hs" "haskell" contents
waitForKickDone
items <- concatMapM (\((x, y), range) ->
Test.prepareCallHierarchy (mkPrepareCallHierarchyParam doc x y)
<&> map (, range)
)
(zip positions ranges)
let expected = map mkCallHierarchyOutgoingCall items
Test.prepareCallHierarchy (mkPrepareCallHierarchyParam doc queryX queryY) >>=
\case
[item] -> do
Test.outgoingCalls (mkOutgoingCallsParam item) >>=
\res -> liftIO $ sort expected @=? sort res
_ -> liftIO $ assertFailure "Not one element"
closeDoc doc
outgoingCallMultiFileTestCase :: FilePath -> Int -> Int -> M.Map FilePath [((Int, Int), Range)] -> Assertion
outgoingCallMultiFileTestCase filepath queryX queryY mp =
runSessionWithServer plugin testDataDir $ do
doc <- openDoc filepath "haskell"
waitForKickDone
items <- fmap concat $ sequence $ M.elems $ M.mapWithKey (\fp pr -> do
p <- openDoc fp "haskell"
waitForKickDone
concatMapM (\((x, y), range) ->
Test.prepareCallHierarchy (mkPrepareCallHierarchyParam p x y)
<&> map (, range)
) pr) mp
let expected = map mkCallHierarchyOutgoingCall items
Test.prepareCallHierarchy (mkPrepareCallHierarchyParam doc queryX queryY) >>=
\case
[item] -> do
Test.outgoingCalls (mkOutgoingCallsParam item) >>=
\res -> liftIO $ sort expected @=? sort res
_ -> liftIO $ assertFailure "Not one element"
closeDoc doc
oneCaseWithCreate :: T.Text -> Int -> Int -> (Uri -> CallHierarchyItem) -> Assertion
oneCaseWithCreate contents queryX queryY expected = withCanonicalTempDir $ \dir ->
runSessionWithServer plugin dir $ do
doc <- createDoc "A.hs" "haskell" contents
waitForKickDone
Test.prepareCallHierarchy (mkPrepareCallHierarchyParam doc queryX queryY) >>=
\case
[item] -> liftIO $ item @?= expected (doc ^. L.uri)
res -> liftIO $ assertFailure "Not one element"
closeDoc doc
mkCallHierarchyItem' :: String -> T.Text -> SymbolKind -> Range -> Range -> Uri -> CallHierarchyItem
mkCallHierarchyItem' prefix name kind range selRange uri =
CallHierarchyItem name kind Nothing (Just "Main") uri range selRange (Just v)
where
v = toJSON $ prefix <> ":" <> T.unpack name <> ":Main:main"
mkCallHierarchyItemC, mkCallHierarchyItemT, mkCallHierarchyItemV ::
T.Text -> SymbolKind -> Range -> Range -> Uri -> CallHierarchyItem
mkCallHierarchyItemC = mkCallHierarchyItem' "c"
mkCallHierarchyItemT = mkCallHierarchyItem' "t"
mkCallHierarchyItemV = mkCallHierarchyItem' "v"
mkCallHierarchyIncomingCall :: (CallHierarchyItem, Range) -> CallHierarchyIncomingCall
mkCallHierarchyIncomingCall (item, range) = CallHierarchyIncomingCall item (List [range])
mkCallHierarchyOutgoingCall :: (CallHierarchyItem, Range) -> CallHierarchyOutgoingCall
mkCallHierarchyOutgoingCall (item, range) = CallHierarchyOutgoingCall item (List [range])
testDataDir :: FilePath
testDataDir = "test" </> "testdata"
mkPrepareCallHierarchyParam :: TextDocumentIdentifier -> Int -> Int -> CallHierarchyPrepareParams
mkPrepareCallHierarchyParam doc x y = CallHierarchyPrepareParams doc (Position (fromIntegral x) (fromIntegral y)) Nothing
mkIncomingCallsParam :: CallHierarchyItem -> CallHierarchyIncomingCallsParams
mkIncomingCallsParam = CallHierarchyIncomingCallsParams Nothing Nothing
mkOutgoingCallsParam :: CallHierarchyItem -> CallHierarchyOutgoingCallsParams
mkOutgoingCallsParam = CallHierarchyOutgoingCallsParams Nothing Nothing