File tree Expand file tree Collapse file tree 1 file changed +4
-27
lines changed
kotlin-lsp/src/com/jetbrains/ls/kotlinLsp Expand file tree Collapse file tree 1 file changed +4
-27
lines changed Original file line number Diff line number Diff line change @@ -81,7 +81,10 @@ private fun run(runConfig: KotlinLspServerRunConfig) {
81
81
82
82
is KotlinLspServerMode .Socket -> {
83
83
logSystemInfo()
84
- tcpConnection(mode) { input, output ->
84
+ tcpConnection(
85
+ clientMode = mode is KotlinLspServerMode .Socket .Client ,
86
+ port = mode.port,
87
+ ) { input, output ->
85
88
handleRequests(input, output, config, mode)
86
89
}
87
90
}
@@ -181,29 +184,3 @@ private fun preloadKotlinStdlibWhenRunningFromSources() {
181
184
KotlinArtifacts .kotlinStdlib
182
185
}
183
186
}
184
-
185
- private suspend fun tcpConnection (mode : KotlinLspServerMode .Socket , body : suspend CoroutineScope .(InputStream , OutputStream ) -> Unit ) {
186
- when (mode) {
187
- is KotlinLspServerMode .Socket .Client -> {
188
- tcpClient(mode.port, body)
189
- }
190
-
191
- is KotlinLspServerMode .Socket .Server -> {
192
- tcpServer(mode.port, body)
193
- }
194
- }
195
- }
196
-
197
- /* *
198
- * VSC opens a **server** socket for LSP to connect to it.
199
- */
200
- private suspend fun tcpClient (port : Int , body : suspend CoroutineScope .(InputStream , OutputStream ) -> Unit ) {
201
- val socket = runInterruptible(Dispatchers .IO ) {
202
- Socket (" localhost" , port)
203
- }
204
- socket.use {
205
- coroutineScope {
206
- body(socket.getInputStream(), socket.getOutputStream())
207
- }
208
- }
209
- }
You can’t perform that action at this time.
0 commit comments