Skip to content

Commit ecddb3a

Browse files
authored
Merge branch 'coder:main' into main
2 parents c3feb36 + 9705045 commit ecddb3a

File tree

7 files changed

+95
-6
lines changed

7 files changed

+95
-6
lines changed

CHANGELOG.md

+27
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,33 @@
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+
22+
## 2.15.2 - 2025-01-06
23+
24+
### Changed
25+
26+
- When starting a workspace, shell out to the Coder binary instead of making an
27+
API call. This reduces drift between what the plugin does and the CLI does.
28+
- Increase workspace polling to one second on the workspace list view, to pick
29+
up changes made via the CLI faster. The recent connections view remains
30+
unchanged at five seconds.
31+
32+
## 2.15.1 - 2024-10-04
33+
734
### Added
835

936
- Support an "owner" parameter when launching an IDE from the dashboard. This

gradle.properties

+1-1
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.1
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

+1-1
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

+15
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

+16
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

+28-4
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
@@ -258,9 +267,24 @@ class CoderWorkspaceProjectIDEStepView(
258267
)
259268
},
260269
)
270+
271+
// Check the provided setting to see if there's a default IDE to set.
272+
val defaultIde = ides.find { it ->
273+
// Using contains on the displayable version of the ide means they can be as specific or as vague as they want
274+
// CL 2023.3.6 233.15619.8 -> a specific Clion build
275+
// CL 2023.3.6 -> a specific Clion version
276+
// 2023.3.6 -> a specific version (some customers will only have one specific IDE in their list anyway)
277+
if (settings.defaultIde.isEmpty()) {
278+
false
279+
} else {
280+
displayIdeWithStatus(it).contains(settings.defaultIde)
281+
}
282+
}
283+
val index = ides.indexOf(defaultIde ?: ides.firstOrNull())
284+
261285
withContext(Dispatchers.IO) {
262286
ideComboBoxModel.addAll(ides)
263-
cbIDE.selectedIndex = 0
287+
cbIDE.selectedIndex = index
264288
}
265289
} catch (e: Exception) {
266290
if (isCancellation(e)) {
@@ -457,9 +481,9 @@ class CoderWorkspaceProjectIDEStepView(
457481
add(JLabel(ideWithStatus.product.ideName, ideWithStatus.product.icon, SwingConstants.LEFT))
458482
add(
459483
JLabel(
460-
"${ideWithStatus.product.productCode} ${ideWithStatus.presentableVersion} ${ideWithStatus.buildNumber} | ${ideWithStatus.status.name.lowercase(
461-
Locale.getDefault(),
462-
)}",
484+
displayIdeWithStatus(
485+
ideWithStatus,
486+
),
463487
).apply {
464488
foreground = UIUtil.getLabelDisabledForeground()
465489
},

src/main/resources/messages/CoderGatewayBundle.properties

+7
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)