diff --git a/plugins/terminal/frontend/src/com/intellij/terminal/frontend/toolwindow/impl/TerminalTitleUtils.kt b/plugins/terminal/frontend/src/com/intellij/terminal/frontend/toolwindow/impl/TerminalTitleUtils.kt index 042ff0647a8d..c66fccd1675c 100644 --- a/plugins/terminal/frontend/src/com/intellij/terminal/frontend/toolwindow/impl/TerminalTitleUtils.kt +++ b/plugins/terminal/frontend/src/com/intellij/terminal/frontend/toolwindow/impl/TerminalTitleUtils.kt @@ -48,15 +48,13 @@ internal fun updateBackendTabNameOnTitleChange( scope: CoroutineScope, ) { title.addListener(scope) { - withContext(Dispatchers.IO) { - durable { - TerminalTabsManagerApi.getInstance().renameTerminalTab( - project.projectId(), - backendTabId, - it.text, - it.isUserDefined - ) - } + durable { + TerminalTabsManagerApi.getInstance().renameTerminalTab( + project.projectId(), + backendTabId, + it.text, + it.isUserDefined + ) } } } diff --git a/plugins/terminal/frontend/src/com/intellij/terminal/frontend/toolwindow/impl/TerminalToolWindowTabsManagerImpl.kt b/plugins/terminal/frontend/src/com/intellij/terminal/frontend/toolwindow/impl/TerminalToolWindowTabsManagerImpl.kt index a739c71124e0..c4eb09c90851 100644 --- a/plugins/terminal/frontend/src/com/intellij/terminal/frontend/toolwindow/impl/TerminalToolWindowTabsManagerImpl.kt +++ b/plugins/terminal/frontend/src/com/intellij/terminal/frontend/toolwindow/impl/TerminalToolWindowTabsManagerImpl.kt @@ -258,7 +258,7 @@ internal class TerminalToolWindowTabsManagerImpl( private fun createBackendTabAndStartSession( terminal: TerminalViewImpl, builder: TerminalToolWindowTabBuilderImpl, - ) = terminal.coroutineScope.launch(Dispatchers.IO) { + ) = terminal.coroutineScope.launch { val backendTabId = builder.backendTabId ?: durable { // todo: worth making it idempotent to avoid creating multiple tabs because of network issues TerminalTabsManagerApi.getInstance().createNewTerminalTab(project.projectId()).id @@ -273,7 +273,7 @@ internal class TerminalToolWindowTabsManagerImpl( val isProjectClosing = getToolWindow().contentManager.isDisposed if (!isProjectClosing) { // Do not block frontend terminal scope cancellation by backend session termination request. - coroutineScope.launch(Dispatchers.IO) { + coroutineScope.launch { durable { TerminalTabsManagerApi.getInstance().closeTerminalTab(project.projectId(), backendTabId) } @@ -315,7 +315,7 @@ internal class TerminalToolWindowTabsManagerImpl( builder: TerminalToolWindowTabBuilderImpl, backendTabId: Int, calculateSizeFromComponent: Boolean, - ) = terminal.coroutineScope.launch(Dispatchers.IO) { + ) = terminal.coroutineScope.launch { if (builder.sessionId != null) { // Session is already started for this tab, reuse it connectSessionToTerminal(terminal, builder.sessionId!!, builder.portForwardingId) @@ -403,7 +403,7 @@ internal class TerminalToolWindowTabsManagerImpl( } private fun scheduleTabsRestoring(manager: TerminalToolWindowTabsManagerImpl) { - manager.tabsRestoredDeferred = manager.coroutineScope.async(Dispatchers.IO) { + manager.tabsRestoredDeferred = manager.coroutineScope.async { val tabs: List = durable { TerminalTabsManagerApi.getInstance().getTerminalTabs(manager.project.projectId()) } diff --git a/plugins/terminal/frontend/src/com/intellij/terminal/frontend/view/impl/TerminalInput.kt b/plugins/terminal/frontend/src/com/intellij/terminal/frontend/view/impl/TerminalInput.kt index 3e67e1e6627a..5f78e90e58fc 100644 --- a/plugins/terminal/frontend/src/com/intellij/terminal/frontend/view/impl/TerminalInput.kt +++ b/plugins/terminal/frontend/src/com/intellij/terminal/frontend/view/impl/TerminalInput.kt @@ -64,7 +64,7 @@ internal class TerminalInput( ) private val inputChannelDeferred: Deferred> = - coroutineScope.async(Dispatchers.IO + CoroutineName("Get input channel")) { + coroutineScope.async(CoroutineName("Get input channel")) { terminalSessionFuture.await().getInputChannel() } diff --git a/plugins/terminal/frontend/src/com/intellij/terminal/frontend/view/impl/TerminalSessionController.kt b/plugins/terminal/frontend/src/com/intellij/terminal/frontend/view/impl/TerminalSessionController.kt index b231eb8817d4..6c950b2c96cd 100644 --- a/plugins/terminal/frontend/src/com/intellij/terminal/frontend/view/impl/TerminalSessionController.kt +++ b/plugins/terminal/frontend/src/com/intellij/terminal/frontend/view/impl/TerminalSessionController.kt @@ -52,7 +52,7 @@ internal class TerminalSessionController( private val edtContext = Dispatchers.EDT + ModalityState.any().asContextElement() fun handleEvents(session: TerminalSession) { - coroutineScope.launch(Dispatchers.IO + CoroutineName("Output flow collection")) { + coroutineScope.launch(CoroutineName("Output flow collection")) { // Get output flow again even if it was terminated. // It can happen in case of RemDev if there were any connection problems and backend decided to terminate the flow. while (!session.isClosed) { diff --git a/plugins/terminal/frontend/src/com/intellij/terminal/frontend/view/impl/TerminalViewImpl.kt b/plugins/terminal/frontend/src/com/intellij/terminal/frontend/view/impl/TerminalViewImpl.kt index a4536ad0a43c..fc976a7fd280 100644 --- a/plugins/terminal/frontend/src/com/intellij/terminal/frontend/view/impl/TerminalViewImpl.kt +++ b/plugins/terminal/frontend/src/com/intellij/terminal/frontend/view/impl/TerminalViewImpl.kt @@ -378,7 +378,7 @@ class TerminalViewImpl( override suspend fun hasChildProcesses(): Boolean { val session = sessionFuture.getNow(null) ?: return false - return withContext(Dispatchers.IO) { + return withContext(Dispatchers.Default) { session.hasRunningCommands() } }