File tree Expand file tree Collapse file tree 2 files changed +23
-11
lines changed
src/com/jetbrains/ls/kotlinLsp
test/com/jetbrains/ls/kotlinLsp Expand file tree Collapse file tree 2 files changed +23
-11
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import java.nio.file.Path
10
10
11
11
data class KotlinLspServerRunConfig (
12
12
val mode : KotlinLspServerMode ,
13
- val systemPath : Path ? = null ,
13
+ val systemPath : Path ? ,
14
14
)
15
15
16
16
sealed interface KotlinLspServerMode {
@@ -79,17 +79,20 @@ private fun String.toSocketConfig(): SocketConfig {
79
79
return SocketConfig (host, port)
80
80
}
81
81
82
- fun KotlinLspServerRunConfig.toArguments (): List <String > =
82
+ fun KotlinLspServerRunConfig.toArguments (): List <String > = buildList {
83
83
when (mode) {
84
- is KotlinLspServerMode .Stdio -> listOf (" --stdio" )
84
+ is KotlinLspServerMode .Stdio -> add (" --stdio" )
85
85
is KotlinLspServerMode .Socket -> when (val tcpConfig = mode.config) {
86
- is TcpConnectionConfig .Client -> buildList {
86
+ is TcpConnectionConfig .Client -> {
87
87
add(" --client" )
88
88
add(" --socket=${tcpConfig.host} :${tcpConfig.port} " )
89
89
}
90
- is TcpConnectionConfig .Server -> buildList {
90
+
91
+ is TcpConnectionConfig .Server -> {
91
92
add(" --socket=${tcpConfig.host} :${tcpConfig.port} " )
92
93
if (tcpConfig.isMultiClient) add(" --multi-client" )
93
94
}
94
95
}
95
- }
96
+ }
97
+ if (systemPath != null ) add(" --system-path=$systemPath " )
98
+ }
Original file line number Diff line number Diff line change @@ -4,18 +4,25 @@ package com.jetbrains.ls.kotlinLsp
4
4
import com.jetbrains.lsp.implementation.TcpConnectionConfig
5
5
import org.junit.jupiter.api.Assertions
6
6
import org.junit.jupiter.api.Test
7
+ import java.nio.file.Paths
7
8
8
9
9
10
class KotlinLspServerRunConfigKtTest {
10
11
@Test
11
12
fun `stdio` () {
12
- doConsistencyTest(KotlinLspServerRunConfig (KotlinLspServerMode .Stdio ))
13
+ doConsistencyTest(KotlinLspServerRunConfig (KotlinLspServerMode .Stdio , systemPath = null ))
13
14
}
14
15
15
16
@Test
16
17
fun `tcp client` () {
17
- doConsistencyTest(KotlinLspServerRunConfig (KotlinLspServerMode .Socket (
18
- TcpConnectionConfig .Client (host = " 127.0.0.1" , port = 9999 ))))
18
+ doConsistencyTest(
19
+ KotlinLspServerRunConfig (
20
+ KotlinLspServerMode .Socket (
21
+ TcpConnectionConfig .Client (host = " 127.0.0.1" , port = 9999 )
22
+ ),
23
+ systemPath = Paths .get(" /path/to/system" ),
24
+ )
25
+ )
19
26
}
20
27
21
28
@Test
@@ -28,7 +35,8 @@ class KotlinLspServerRunConfigKtTest {
28
35
port = 9999 ,
29
36
isMultiClient = false
30
37
)
31
- )
38
+ ),
39
+ systemPath = Paths .get(" /path/to/system" ),
32
40
)
33
41
)
34
42
}
@@ -43,7 +51,8 @@ class KotlinLspServerRunConfigKtTest {
43
51
port = 9999 ,
44
52
isMultiClient = true
45
53
)
46
- )
54
+ ),
55
+ systemPath = null ,
47
56
)
48
57
)
49
58
}
You can’t perform that action at this time.
0 commit comments