Skip to content

Commit 284666a

Browse files
committed
Build: fix warnings and compilation for 242
1 parent 6e62cd8 commit 284666a

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/main/kotlin/com/intellij/plugin/powershell/ide/run/PowerShellProgramRunner.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ import com.intellij.execution.runners.AsyncProgramRunner
88
import com.intellij.execution.runners.ExecutionEnvironment
99
import com.intellij.execution.runners.showRunContent
1010
import com.intellij.execution.ui.RunContentDescriptor
11+
import com.intellij.openapi.application.EDT
1112
import com.intellij.openapi.fileEditor.FileDocumentManager
1213
import com.intellij.openapi.rd.util.toPromise
13-
import com.intellij.openapi.rd.util.withUiContext
1414
import com.intellij.plugin.powershell.ide.PluginProjectRoot
1515
import kotlinx.coroutines.Dispatchers
1616
import kotlinx.coroutines.ExperimentalCoroutinesApi
1717
import kotlinx.coroutines.async
18+
import kotlinx.coroutines.withContext
1819
import org.jetbrains.concurrency.Promise
1920

2021
/**
@@ -32,12 +33,12 @@ class PowerShellProgramRunner : AsyncProgramRunner<RunnerSettings>() {
3233
override fun execute(environment: ExecutionEnvironment, state: RunProfileState): Promise<RunContentDescriptor?> =
3334
PluginProjectRoot.getInstance(environment.project).coroutineScope.async(Dispatchers.Default) {
3435
state as PowerShellScriptCommandLineState
35-
withUiContext {
36+
withContext(Dispatchers.EDT) {
3637
FileDocumentManager.getInstance().saveAllDocuments()
3738
}
3839
state.prepareExecution()
3940
val executionResult = state.execute(environment.executor, this@PowerShellProgramRunner)
40-
val descriptor = withUiContext { showRunContent(executionResult, environment) }
41+
val descriptor = withContext(Dispatchers.EDT) { showRunContent(executionResult, environment) }
4142
descriptor
4243
}.toPromise()
4344
}

src/main/kotlin/com/intellij/plugin/powershell/lang/lsp/languagehost/EditorServicesLanguageHostStarter.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import com.intellij.openapi.application.ApplicationInfo
1313
import com.intellij.openapi.application.ApplicationNamesInfo
1414
import com.intellij.openapi.diagnostic.logger
1515
import com.intellij.openapi.project.Project
16-
import com.intellij.openapi.rd.util.withSyncIOBackgroundContext
1716
import com.intellij.openapi.util.Key
1817
import com.intellij.openapi.util.SystemInfo
1918
import com.intellij.openapi.util.io.FileUtil
@@ -33,7 +32,9 @@ import com.intellij.util.io.await
3332
import com.sun.jna.Pointer
3433
import com.sun.jna.platform.win32.Kernel32
3534
import com.sun.jna.platform.win32.WinNT
35+
import kotlinx.coroutines.Dispatchers
3636
import kotlinx.coroutines.delay
37+
import kotlinx.coroutines.withContext
3738
import org.newsclub.net.unix.AFUNIXSocket
3839
import org.newsclub.net.unix.AFUNIXSocketAddress
3940
import java.io.*
@@ -140,7 +141,7 @@ open class EditorServicesLanguageHostStarter(protected val myProject: Project) :
140141
if (sessionInfo is SessionInfo.Pipes) {
141142
val readPipeName = sessionInfo.languageServiceReadPipeName
142143
val writePipeName = sessionInfo.languageServiceWritePipeName
143-
return withSyncIOBackgroundContext {
144+
return withContext(Dispatchers.IO) {
144145
if (SystemInfo.isWindows) {
145146
val readPipe = RandomAccessFile(readPipeName, "rwd")
146147
val writePipe = RandomAccessFile(writePipeName, "r")
@@ -158,7 +159,7 @@ open class EditorServicesLanguageHostStarter(protected val myProject: Project) :
158159
}
159160
}
160161
} else {
161-
return withSyncIOBackgroundContext block@{
162+
return withContext(Dispatchers.IO) block@{
162163
val port = (sessionInfo as? SessionInfo.Tcp)?.languageServicePort ?: return@block Pair(null, null)
163164
try {
164165
socket = Socket("127.0.0.1", port)
@@ -244,7 +245,7 @@ open class EditorServicesLanguageHostStarter(protected val myProject: Project) :
244245
} else ""
245246
val scriptText = "$preamble${escapePath(startupScript)} $args"
246247

247-
val scriptFile = withSyncIOBackgroundContext {
248+
val scriptFile = withContext(Dispatchers.IO) {
248249
File.createTempFile("start-pses-host", ".ps1").apply {
249250
deleteOnExit()
250251
try {

0 commit comments

Comments
 (0)