Skip to content

Commit bec48d1

Browse files
committed
Merge branch 'main' into eap
2 parents 581e8a2 + 8805868 commit bec48d1

22 files changed

+64
-59
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44

55
## Unreleased
66

7+
### Fixed
8+
9+
- Listing IDEs when using the plugin from the File > Remote Development option
10+
within a local IDE should now work.
11+
- Recent connections are now preserved.
12+
713
## 2.9.1 - 2023-11-06
814

915
### Fixed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ plugins {
99
// Groovy support
1010
id("groovy")
1111
// Kotlin support
12-
id("org.jetbrains.kotlin.jvm") version "1.9.10"
12+
id("org.jetbrains.kotlin.jvm") version "1.9.20"
1313
// Gradle IntelliJ Plugin
1414
id("org.jetbrains.intellij") version "1.13.3"
1515
// Gradle Changelog Plugin

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
pluginGroup=com.coder.gateway
44
pluginName=coder-gateway
55
# SemVer format -> https://semver.org
6-
pluginVersion=2.9.1-eap.0
6+
pluginVersion=2.9.2-eap.0
77
# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
88
# for insight into build numbers and IntelliJ Platform versions.
99
pluginSinceBuild=233.6745

src/main/kotlin/com/coder/gateway/CoderRemoteConnectionHandle.kt

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ import com.jetbrains.gateway.ssh.SshDeployFlowUtil
3131
import com.jetbrains.gateway.ssh.SshMultistagePanelContext
3232
import com.jetbrains.gateway.ssh.deploy.DeployException
3333
import com.jetbrains.rd.util.lifetime.LifetimeDefinition
34-
import kotlinx.coroutines.GlobalScope
35-
import kotlinx.coroutines.launch
3634
import net.schmizz.sshj.common.SSHException
3735
import net.schmizz.sshj.connection.ConnectionException
3836
import java.awt.Dimension
@@ -48,7 +46,7 @@ import javax.net.ssl.SSLHandshakeException
4846
class CoderRemoteConnectionHandle {
4947
private val recentConnectionsService = service<CoderRecentWorkspaceConnectionsService>()
5048

51-
suspend fun connect(getParameters: (indicator: ProgressIndicator) -> Map<String, String>) {
49+
fun connect(getParameters: (indicator: ProgressIndicator) -> Map<String, String>) {
5250
val clientLifetime = LifetimeDefinition()
5351
clientLifetime.launchUnderBackgroundProgress(CoderGatewayBundle.message("gateway.connector.coder.connection.provider.title")) {
5452
try {
@@ -79,13 +77,11 @@ class CoderRemoteConnectionHandle {
7977
indicator.text = CoderGatewayBundle.message("gateway.connector.coder.connecting.failed.retry", humanizeDuration(remainingMs))
8078
},
8179
)
82-
GlobalScope.launch {
83-
logger.info("Deploying and starting IDE with $context")
84-
// At this point JetBrains takes over with their own UI.
85-
@Suppress("UnstableApiUsage") SshDeployFlowUtil.fullDeployCycle(
86-
clientLifetime, context, Duration.ofMinutes(10)
87-
)
88-
}
80+
logger.info("Deploying and starting IDE with $context")
81+
// At this point JetBrains takes over with their own UI.
82+
@Suppress("UnstableApiUsage") SshDeployFlowUtil.fullDeployCycle(
83+
clientLifetime, context, Duration.ofMinutes(10)
84+
)
8985
recentConnectionsService.addRecentConnection(parameters.toRecentWorkspaceConnection())
9086
} catch (e: Exception) {
9187
if (isCancellation(e)) {

src/main/kotlin/com/coder/gateway/models/RecentWorkspaceConnection.kt

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,51 @@ import com.intellij.openapi.components.BaseState
44
import com.intellij.util.xmlb.annotations.Attribute
55

66
class RecentWorkspaceConnection(
7+
coderWorkspaceHostname: String? = null,
8+
projectPath: String? = null,
9+
lastOpened: String? = null,
10+
ideProductCode: String? = null,
11+
ideBuildNumber: String? = null,
12+
downloadSource: String? = null,
13+
idePathOnHost: String? = null,
14+
webTerminalLink: String? = null,
15+
configDirectory: String? = null,
16+
name: String? = null,
17+
) : BaseState(), Comparable<RecentWorkspaceConnection> {
718
@get:Attribute
8-
var coderWorkspaceHostname: String? = null,
19+
var coderWorkspaceHostname by string()
920
@get:Attribute
10-
var projectPath: String? = null,
21+
var projectPath by string()
1122
@get:Attribute
12-
var lastOpened: String? = null,
23+
var lastOpened by string()
1324
@get:Attribute
14-
var ideProductCode: String? = null,
25+
var ideProductCode by string()
1526
@get:Attribute
16-
var ideBuildNumber: String? = null,
27+
var ideBuildNumber by string()
1728
@get:Attribute
18-
var downloadSource: String? = null,
29+
var downloadSource by string()
1930
@get:Attribute
20-
var idePathOnHost: String? = null,
31+
var idePathOnHost by string()
2132
@get:Attribute
22-
var webTerminalLink: String? = null,
33+
var webTerminalLink by string()
2334
@get:Attribute
24-
var configDirectory: String? = null,
35+
var configDirectory by string()
2536
@get:Attribute
26-
var name: String? = null,
27-
) : BaseState(), Comparable<RecentWorkspaceConnection> {
37+
var name by string()
38+
39+
init {
40+
this.coderWorkspaceHostname = coderWorkspaceHostname
41+
this.projectPath = projectPath
42+
this.lastOpened = lastOpened
43+
this.ideProductCode = ideProductCode
44+
this.ideBuildNumber = ideBuildNumber
45+
this.downloadSource = downloadSource
46+
this.idePathOnHost = idePathOnHost
47+
this.webTerminalLink = webTerminalLink
48+
this.configDirectory = configDirectory
49+
this.name = name
50+
}
51+
2852
override fun equals(other: Any?): Boolean {
2953
if (this === other) return true
3054
if (javaClass != other?.javaClass) return false

src/main/kotlin/com/coder/gateway/sdk/CoderCLIManager.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,6 @@ class CoderCLIManager @JvmOverloads constructor(
234234
transform = {
235235
"""
236236
Host ${getHostName(deploymentURL, it)}
237-
HostName coder.${it.name}
238237
ProxyCommand ${proxyArgs.joinToString(" ")} ${it.name}
239238
ConnectTimeout 0
240239
StrictHostKeyChecking no

src/main/kotlin/com/coder/gateway/views/CoderGatewayRecentWorkspaceConnectionsView.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,8 @@ class CoderGatewayRecentWorkspaceConnectionsView(private val setContentCallback:
212212
row {
213213
icon(product.icon)
214214
cell(ActionLink(connectionDetails.projectPath!!) {
215-
cs.launch {
216-
CoderRemoteConnectionHandle().connect{ connectionDetails.toWorkspaceParams() }
217-
GatewayUI.getInstance().reset()
218-
}
215+
CoderRemoteConnectionHandle().connect{ connectionDetails.toWorkspaceParams() }
216+
GatewayUI.getInstance().reset()
219217
})
220218
label("").resizableColumn().align(AlignX.FILL)
221219
label("Last opened: ${connectionDetails.lastOpened}").applyToComponent {

src/main/kotlin/com/coder/gateway/views/steps/CoderLocateRemoteProjectStepView.kt

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ import com.coder.gateway.withWorkspaceHostname
2525
import com.intellij.ide.IdeBundle
2626
import com.intellij.openapi.Disposable
2727
import com.intellij.openapi.application.ApplicationManager
28+
import com.intellij.openapi.application.ModalityState
29+
import com.intellij.openapi.application.asContextElement
2830
import com.intellij.openapi.diagnostic.Logger
2931
import com.intellij.openapi.ui.ComboBox
3032
import com.intellij.openapi.ui.ComponentValidator
@@ -65,7 +67,6 @@ import kotlinx.coroutines.Dispatchers
6567
import kotlinx.coroutines.Job
6668
import kotlinx.coroutines.async
6769
import kotlinx.coroutines.cancel
68-
import kotlinx.coroutines.cancelAndJoin
6970
import kotlinx.coroutines.launch
7071
import kotlinx.coroutines.runBlocking
7172
import kotlinx.coroutines.withContext
@@ -181,7 +182,7 @@ class CoderLocateRemoteProjectStepView(private val setNextButtonEnabled: (Boolea
181182
titleLabel.text = CoderGatewayBundle.message("gateway.connector.view.coder.remoteproject.choose.text", selectedWorkspace.name)
182183
terminalLink.url = clientService.client.url.withPath("/@${clientService.me.username}/${selectedWorkspace.name}/terminal").toString()
183184

184-
ideResolvingJob = cs.launch {
185+
ideResolvingJob = cs.launch(ModalityState.current().asContextElement()) {
185186
try {
186187
val ides = suspendingRetryWithExponentialBackOff(
187188
action = { attempt ->
@@ -338,27 +339,23 @@ class CoderLocateRemoteProjectStepView(private val setNextButtonEnabled: (Boolea
338339
logger.warn("No workspace was selected. Please go back to the previous step and select a workspace")
339340
return false
340341
}
341-
cs.launch {
342-
CoderRemoteConnectionHandle().connect{
343-
selectedIDE
344-
.toWorkspaceParams()
345-
.withWorkspaceHostname(CoderCLIManager.getHostName(deploymentURL, selectedWorkspace))
346-
.withProjectPath(tfProject.text)
347-
.withWebTerminalLink("${terminalLink.url}")
348-
.withConfigDirectory(wizardModel.configDirectory)
349-
.withName(selectedWorkspace.name)
350-
}
351-
GatewayUI.getInstance().reset()
342+
CoderRemoteConnectionHandle().connect{
343+
selectedIDE
344+
.toWorkspaceParams()
345+
.withWorkspaceHostname(CoderCLIManager.getHostName(deploymentURL, selectedWorkspace))
346+
.withProjectPath(tfProject.text)
347+
.withWebTerminalLink("${terminalLink.url}")
348+
.withConfigDirectory(wizardModel.configDirectory)
349+
.withName(selectedWorkspace.name)
352350
}
351+
GatewayUI.getInstance().reset()
353352
return true
354353
}
355354

356355
override fun onPrevious() {
357356
super.onPrevious()
358357
logger.info("Going back to Workspace view")
359-
cs.launch {
360-
ideResolvingJob.cancelAndJoin()
361-
}
358+
ideResolvingJob?.cancel()
362359
}
363360

364361
override fun dispose() {

src/test/fixtures/outputs/append-blank-newlines.conf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
# --- START CODER JETBRAINS test.coder.invalid
66
Host coder-jetbrains--foo-bar--test.coder.invalid
7-
HostName coder.foo-bar
87
ProxyCommand /tmp/coder-gateway/test.coder.invalid/coder-linux-amd64 --global-config /tmp/coder-gateway/test.coder.invalid/config ssh --stdio foo-bar
98
ConnectTimeout 0
109
StrictHostKeyChecking no

src/test/fixtures/outputs/append-blank.conf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# --- START CODER JETBRAINS test.coder.invalid
22
Host coder-jetbrains--foo-bar--test.coder.invalid
3-
HostName coder.foo-bar
43
ProxyCommand /tmp/coder-gateway/test.coder.invalid/coder-linux-amd64 --global-config /tmp/coder-gateway/test.coder.invalid/config ssh --stdio foo-bar
54
ConnectTimeout 0
65
StrictHostKeyChecking no

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy