-
Notifications
You must be signed in to change notification settings - Fork 315
/
BaseInlayHintsExpectSuite.scala
54 lines (49 loc) 路 1.47 KB
/
BaseInlayHintsExpectSuite.scala
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
package tests
import scala.meta.internal.metals.CompilerInlayHintsParams
import scala.meta.internal.metals.CompilerRangeParams
import scala.meta.internal.metals.EmptyCancelToken
import scala.meta.internal.metals.MetalsEnrichments._
import scala.meta.internal.metals.UserConfiguration
import scala.meta.pc.PresentationCompiler
abstract class BaseInlayHintsExpectSuite(
name: String,
inputProperties: => InputProperties,
) extends DirectoryExpectSuite(name) {
def compiler: PresentationCompiler
override lazy val input: InputProperties = inputProperties
val userConfig: UserConfiguration = UserConfiguration().copy(
showInferredType = Some("true"),
showImplicitArguments = true,
showImplicitConversionsAndClasses = true,
)
override def testCases(): List[ExpectTestCase] = {
input.scalaFiles.map { file =>
ExpectTestCase(
file,
() => {
val rangeParams = CompilerRangeParams(
file.file.toURI,
file.code,
0,
file.code.length,
EmptyCancelToken,
)
val pcParams = CompilerInlayHintsParams(
rangeParams,
true,
true,
true,
true,
true,
)
val inlayHints =
compiler.inlayHints(pcParams).get().asScala.toList
TestInlayHints.applyInlayHints(file.code, inlayHints)
},
)
}
}
override def afterAll(): Unit = {
compiler.shutdown()
}
}