Skip to content

Commit 3e617b6

Browse files
darthorimarintellij-monorepo-bot
authored andcommitted
[lsp] add missing KotlinLspServerRunConfig.systemPath to arguments to string conversion
GitOrigin-RevId: 72bbc34aed65cc3ab18b2e0565f804a925db165e
1 parent 9466862 commit 3e617b6

File tree

2 files changed

+23
-11
lines changed

2 files changed

+23
-11
lines changed

kotlin-lsp/src/com/jetbrains/ls/kotlinLsp/KotlinLspServerRunConfig.kt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import java.nio.file.Path
1010

1111
data class KotlinLspServerRunConfig(
1212
val mode: KotlinLspServerMode,
13-
val systemPath: Path? = null,
13+
val systemPath: Path?,
1414
)
1515

1616
sealed interface KotlinLspServerMode {
@@ -79,17 +79,20 @@ private fun String.toSocketConfig(): SocketConfig {
7979
return SocketConfig(host, port)
8080
}
8181

82-
fun KotlinLspServerRunConfig.toArguments(): List<String> =
82+
fun KotlinLspServerRunConfig.toArguments(): List<String> = buildList {
8383
when (mode) {
84-
is KotlinLspServerMode.Stdio -> listOf("--stdio")
84+
is KotlinLspServerMode.Stdio -> add("--stdio")
8585
is KotlinLspServerMode.Socket -> when (val tcpConfig = mode.config) {
86-
is TcpConnectionConfig.Client -> buildList {
86+
is TcpConnectionConfig.Client -> {
8787
add("--client")
8888
add("--socket=${tcpConfig.host}:${tcpConfig.port}")
8989
}
90-
is TcpConnectionConfig.Server -> buildList {
90+
91+
is TcpConnectionConfig.Server -> {
9192
add("--socket=${tcpConfig.host}:${tcpConfig.port}")
9293
if (tcpConfig.isMultiClient) add("--multi-client")
9394
}
9495
}
95-
}
96+
}
97+
if (systemPath != null) add("--system-path=$systemPath")
98+
}

kotlin-lsp/test/com/jetbrains/ls/kotlinLsp/KotlinLspServerRunConfigKtTest.kt

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,25 @@ package com.jetbrains.ls.kotlinLsp
44
import com.jetbrains.lsp.implementation.TcpConnectionConfig
55
import org.junit.jupiter.api.Assertions
66
import org.junit.jupiter.api.Test
7+
import java.nio.file.Paths
78

89

910
class KotlinLspServerRunConfigKtTest {
1011
@Test
1112
fun `stdio`() {
12-
doConsistencyTest(KotlinLspServerRunConfig(KotlinLspServerMode.Stdio))
13+
doConsistencyTest(KotlinLspServerRunConfig(KotlinLspServerMode.Stdio, systemPath = null))
1314
}
1415

1516
@Test
1617
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+
)
1926
}
2027

2128
@Test
@@ -28,7 +35,8 @@ class KotlinLspServerRunConfigKtTest {
2835
port = 9999,
2936
isMultiClient = false
3037
)
31-
)
38+
),
39+
systemPath = Paths.get("/path/to/system"),
3240
)
3341
)
3442
}
@@ -43,7 +51,8 @@ class KotlinLspServerRunConfigKtTest {
4351
port = 9999,
4452
isMultiClient = true
4553
)
46-
)
54+
),
55+
systemPath = null,
4756
)
4857
)
4958
}

0 commit comments

Comments
 (0)