@@ -23,6 +23,7 @@ import com.intellij.openapi.util.Disposer
2323import com.intellij.openapi.wm.impl.welcomeScreen.WelcomeScreenUIManager
2424import com.intellij.remote.AuthType
2525import com.intellij.remote.RemoteCredentialsHolder
26+ import com.intellij.ssh.SshException
2627import com.intellij.ui.AnimatedIcon
2728import com.intellij.ui.ColoredListCellRenderer
2829import com.intellij.ui.DocumentAdapter
@@ -49,14 +50,17 @@ import kotlinx.coroutines.CancellationException
4950import kotlinx.coroutines.CoroutineScope
5051import kotlinx.coroutines.Dispatchers
5152import kotlinx.coroutines.Job
53+ import kotlinx.coroutines.TimeoutCancellationException
5254import kotlinx.coroutines.async
5355import kotlinx.coroutines.cancel
5456import kotlinx.coroutines.cancelAndJoin
5557import kotlinx.coroutines.launch
5658import kotlinx.coroutines.runBlocking
59+ import kotlinx.coroutines.time.withTimeout
5760import kotlinx.coroutines.withContext
5861import java.awt.Component
5962import java.awt.FlowLayout
63+ import java.time.Duration
6064import java.util.Locale
6165import javax.swing.ComboBoxModel
6266import javax.swing.DefaultComboBoxModel
@@ -134,7 +138,7 @@ class CoderLocateRemoteProjectStepView(private val disableNextAction: () -> Unit
134138
135139 ideResolvingJob = cs.launch {
136140 try {
137- val executor = withContext( Dispatchers . IO ) { createRemoteExecutor() }
141+ val executor = withTimeout( Duration .ofSeconds( 30 ) ) { createRemoteExecutor() }
138142 retrieveIDES(executor, selectedWorkspace)
139143 if (ComponentValidator .getInstance(tfProject).isEmpty) {
140144 installRemotePathValidator(executor)
@@ -143,6 +147,21 @@ class CoderLocateRemoteProjectStepView(private val disableNextAction: () -> Unit
143147 when (e) {
144148 is InterruptedException -> Unit
145149 is CancellationException -> Unit
150+ is TimeoutCancellationException ,
151+ is SshException -> {
152+ logger.error(" Can't connect to workspace ${selectedWorkspace.name} . Reason: $e " )
153+ withContext(Dispatchers .Main ) {
154+ disableNextAction()
155+ cbIDE.renderer = object : ColoredListCellRenderer <IdeWithStatus >() {
156+ override fun customizeCellRenderer (list : JList <out IdeWithStatus >, value : IdeWithStatus ? , index : Int , isSelected : Boolean , cellHasFocus : Boolean ) {
157+ background = UIUtil .getListBackground(isSelected, cellHasFocus)
158+ icon = UIUtil .getBalloonErrorIcon()
159+ append(" Can't connect to the workspace. Please make sure Coder Agent is running!" )
160+ }
161+ }
162+ }
163+ }
164+
146165 else -> {
147166 logger.error(" Could not resolve any IDE for workspace ${selectedWorkspace.name} . Reason: $e " )
148167 withContext(Dispatchers .Main ) {
0 commit comments