Skip to content

Commit 29a18ab

Browse files
authored
Merge branch 'main' into wildcard-ssh
2 parents ebf86fa + 9705045 commit 29a18ab

File tree

7 files changed

+83
-6
lines changed

7 files changed

+83
-6
lines changed

CHANGELOG.md

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

55
## Unreleased
66

7+
## 2.17.0 - 2025-01-27
8+
9+
### Added
10+
11+
- Added setting "Check for IDE updates" which controls whether the plugin
12+
checks and prompts for available IDE backend updates.
13+
14+
## 2.16.0 - 2025-01-17
15+
16+
### Added
17+
18+
- Added setting "Default IDE Selection" which will look for a matching IDE
19+
code/version/build number to set as the preselected IDE in the select
20+
component.
21+
722
## 2.15.2 - 2025-01-06
823

924
### Changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pluginGroup=com.coder.gateway
44
# Zip file name.
55
pluginName=coder-gateway
66
# SemVer format -> https://semver.org
7-
pluginVersion=2.15.2
7+
pluginVersion=2.17.0
88
# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
99
# for insight into build numbers and IntelliJ Platform versions.
1010
pluginSinceBuild=233.6745

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class CoderRemoteConnectionHandle {
9393
},
9494
true,
9595
)
96-
if (attempt == 1) {
96+
if (settings.checkIDEUpdate && attempt == 1) {
9797
// See if there is a newer (non-EAP) version of the IDE available.
9898
checkUpdate(accessor, parameters, indicator)?.let { update ->
9999
// Store the old IDE to delete later.

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,21 @@ class CoderSettingsConfigurable : BoundConfigurable("Coder") {
149149
.bindText(state::workspaceFilter)
150150
.comment(CoderGatewayBundle.message("gateway.connector.settings.workspace-filter.comment"))
151151
}.layout(RowLayout.PARENT_GRID)
152+
row(CoderGatewayBundle.message("gateway.connector.settings.default-ide")) {
153+
textField().resizableColumn().align(AlignX.FILL)
154+
.bindText(state::defaultIde)
155+
.comment(
156+
"The default IDE version to display in the IDE selection dropdown. " +
157+
"Example format: CL 2023.3.6 233.15619.8",
158+
)
159+
}
160+
row(CoderGatewayBundle.message("gateway.connector.settings.check-ide-updates.heading")) {
161+
checkBox(CoderGatewayBundle.message("gateway.connector.settings.check-ide-updates.title"))
162+
.bindSelected(state::checkIDEUpdates)
163+
.comment(
164+
CoderGatewayBundle.message("gateway.connector.settings.check-ide-updates.comment"),
165+
)
166+
}.layout(RowLayout.PARENT_GRID)
152167
}
153168
}
154169

src/main/kotlin/com/coder/gateway/settings/CoderSettings.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ open class CoderSettingsState(
100100
open var sshLogDirectory: String = "",
101101
// Default filter for fetching workspaces
102102
open var workspaceFilter: String = "owner:me",
103+
// Default version of IDE to display in IDE selection dropdown
104+
open var defaultIde: String = "",
105+
// Whether to check for IDE updates.
106+
open var checkIDEUpdates: Boolean = true,
103107
)
104108

105109
/**
@@ -174,6 +178,18 @@ open class CoderSettings(
174178
val setupCommand: String
175179
get() = state.setupCommand
176180

181+
/**
182+
* The default IDE version to display in the selection menu
183+
*/
184+
val defaultIde: String
185+
get() = state.defaultIde
186+
187+
/**
188+
* Whether to check for IDE updates.
189+
*/
190+
val checkIDEUpdate: Boolean
191+
get() = state.checkIDEUpdates
192+
177193
/**
178194
* Whether to ignore a failed setup command.
179195
*/

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

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import com.coder.gateway.models.toIdeWithStatus
88
import com.coder.gateway.models.withWorkspaceProject
99
import com.coder.gateway.sdk.v2.models.Workspace
1010
import com.coder.gateway.sdk.v2.models.WorkspaceAgent
11+
import com.coder.gateway.services.CoderSettingsService
1112
import com.coder.gateway.util.Arch
1213
import com.coder.gateway.util.OS
1314
import com.coder.gateway.util.humanizeDuration
@@ -20,6 +21,7 @@ import com.coder.gateway.views.LazyBrowserLink
2021
import com.intellij.openapi.application.ApplicationManager
2122
import com.intellij.openapi.application.ModalityState
2223
import com.intellij.openapi.application.asContextElement
24+
import com.intellij.openapi.components.service
2325
import com.intellij.openapi.diagnostic.Logger
2426
import com.intellij.openapi.ui.ComboBox
2527
import com.intellij.openapi.ui.ComponentValidator
@@ -79,6 +81,11 @@ import javax.swing.ListCellRenderer
7981
import javax.swing.SwingConstants
8082
import javax.swing.event.DocumentEvent
8183

84+
// Just extracting the way we display the IDE info into a helper function.
85+
private fun displayIdeWithStatus(ideWithStatus: IdeWithStatus): String = "${ideWithStatus.product.productCode} ${ideWithStatus.presentableVersion} ${ideWithStatus.buildNumber} | ${ideWithStatus.status.name.lowercase(
86+
Locale.getDefault(),
87+
)}"
88+
8289
/**
8390
* View for a single workspace. In particular, show available IDEs and a button
8491
* to select an IDE and project to run on the workspace.
@@ -88,6 +95,8 @@ class CoderWorkspaceProjectIDEStepView(
8895
) : CoderWizardStep<WorkspaceProjectIDE>(
8996
CoderGatewayBundle.message("gateway.connector.view.coder.remoteproject.next.text"),
9097
) {
98+
private val settings: CoderSettingsService = service<CoderSettingsService>()
99+
91100
private val cs = CoroutineScope(Dispatchers.IO)
92101
private var ideComboBoxModel = DefaultComboBoxModel<IdeWithStatus>()
93102
private var state: CoderWorkspacesStepSelection? = null
@@ -262,9 +271,24 @@ class CoderWorkspaceProjectIDEStepView(
262271
)
263272
},
264273
)
274+
275+
// Check the provided setting to see if there's a default IDE to set.
276+
val defaultIde = ides.find { it ->
277+
// Using contains on the displayable version of the ide means they can be as specific or as vague as they want
278+
// CL 2023.3.6 233.15619.8 -> a specific Clion build
279+
// CL 2023.3.6 -> a specific Clion version
280+
// 2023.3.6 -> a specific version (some customers will only have one specific IDE in their list anyway)
281+
if (settings.defaultIde.isEmpty()) {
282+
false
283+
} else {
284+
displayIdeWithStatus(it).contains(settings.defaultIde)
285+
}
286+
}
287+
val index = ides.indexOf(defaultIde ?: ides.firstOrNull())
288+
265289
withContext(Dispatchers.IO) {
266290
ideComboBoxModel.addAll(ides)
267-
cbIDE.selectedIndex = 0
291+
cbIDE.selectedIndex = index
268292
}
269293
} catch (e: Exception) {
270294
if (isCancellation(e)) {
@@ -461,9 +485,9 @@ class CoderWorkspaceProjectIDEStepView(
461485
add(JLabel(ideWithStatus.product.ideName, ideWithStatus.product.icon, SwingConstants.LEFT))
462486
add(
463487
JLabel(
464-
"${ideWithStatus.product.productCode} ${ideWithStatus.presentableVersion} ${ideWithStatus.buildNumber} | ${ideWithStatus.status.name.lowercase(
465-
Locale.getDefault(),
466-
)}",
488+
displayIdeWithStatus(
489+
ideWithStatus,
490+
),
467491
).apply {
468492
foreground = UIUtil.getLabelDisabledForeground()
469493
},

src/main/resources/messages/CoderGatewayBundle.properties

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,10 @@ gateway.connector.settings.workspace-filter.comment=The filter to apply when \
138138
the plugin fetches resources individually for each non-running workspace, \
139139
which can be slow with many workspaces, and it adds every agent to the SSH \
140140
config, which can result in a large SSH config with many workspaces.
141+
gateway.connector.settings.default-ide=Default IDE Selection
142+
gateway.connector.settings.check-ide-updates.heading=IDE version check
143+
gateway.connector.settings.check-ide-updates.title=Check for IDE updates
144+
gateway.connector.settings.check-ide-updates.comment=Checking this box will \
145+
cause the plugin to check for available IDE backend updates and prompt \
146+
with an option to upgrade if a newer version is available.
147+

0 commit comments

Comments
 (0)