-
Notifications
You must be signed in to change notification settings - Fork 315
/
BaseInlayHintsLspSuite.scala
55 lines (53 loc) 路 1.56 KB
/
BaseInlayHintsLspSuite.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
55
package tests
import munit.Location
import munit.TestOptions
import tests.BaseLspSuite
import tests.TestInlayHints
abstract class BaseInlayHintsLspSuite(name: String, scalaVersion: String)
extends BaseLspSuite(name) {
def check(
name: TestOptions,
expected: String,
config: Option[String] = None,
dependencies: List[String] = Nil,
)(implicit
loc: Location
): Unit = {
val initConfig = config
.map(config => s"""{
|$config
|}
|""".stripMargin)
.getOrElse("""{
| "show-implicit-arguments": true,
| "show-implicit-conversions-and-classes": true,
| "show-inferred-type": "true",
| "show-evidence-params": true
|}
|""".stripMargin)
val fileName = "Main.scala"
val code = TestInlayHints.removeInlayHints(expected)
test(name) {
for {
_ <- initialize(
s"""/metals.json
|{"a":{
| "scalaVersion": "$scalaVersion",
| "libraryDependencies": ${toJsonArray(dependencies)}
|}}
|/a/src/main/scala/a/$fileName
|$code
""".stripMargin
)
_ <- server.didOpen(s"a/src/main/scala/a/$fileName")
_ <- server.didChangeConfiguration(initConfig)
_ <- server.assertInlayHints(
s"a/src/main/scala/a/$fileName",
code,
expected,
workspace,
)
} yield ()
}
}
}