Skip to content

Initial impl of defaultIde selection setting #522

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Selected KT Lint changes.
  • Loading branch information
bcpeinhardt committed Jan 17, 2025
commit cc260fa8108f1d1e9939cfeca1c3177673bb2a77
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,11 @@ class CoderSettingsConfigurable : BoundConfigurable("Coder") {
}.layout(RowLayout.PARENT_GRID)
row(CoderGatewayBundle.message("gateway.connector.settings.default-ide")) {
textField().resizableColumn().align(AlignX.FILL)
.bindText(state::defaultIde)
.comment("The default IDE version to display in the IDE selection dropdown. " +
"Example format: CL 2023.3.6 233.15619.8")
.bindText(state::defaultIde)
.comment(
"The default IDE version to display in the IDE selection dropdown. " +
"Example format: CL 2023.3.6 233.15619.8",
)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
import com.jetbrains.gateway.ssh.IntelliJPlatformProduct
import com.jetbrains.gateway.ssh.deploy.DeployException
import com.jetbrains.gateway.ssh.util.validateRemotePath
import com.jetbrains.rd.generator.nova.PredefinedType
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
Expand All @@ -83,11 +82,9 @@
import javax.swing.event.DocumentEvent

// Just extracting the way we display the IDE info into a helper function.
private fun displayIdeWithStatus(ideWithStatus: IdeWithStatus): String {
return "${ideWithStatus.product.productCode} ${ideWithStatus.presentableVersion} ${ideWithStatus.buildNumber} | ${ideWithStatus.status.name.lowercase(
Locale.getDefault(),
)}"
}
private fun displayIdeWithStatus(ideWithStatus: IdeWithStatus): String = "${ideWithStatus.product.productCode} ${ideWithStatus.presentableVersion} ${ideWithStatus.buildNumber} | ${ideWithStatus.status.name.lowercase(
Locale.getDefault(),
)}"

/**
* View for a single workspace. In particular, show available IDEs and a button
Expand Down Expand Up @@ -272,7 +269,7 @@
)

// Check the provided setting to see if there's a default IDE to set.
val defaultIde = ides.find { it ->

Check notice on line 272 in src/main/kotlin/com/coder/gateway/views/steps/CoderWorkspaceProjectIDEStepView.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Redundant lambda arrow

Redundant lambda arrow
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Qodana will complain about it -> since that is the default, although idk how much we should care about Qodana. Possibly ktlint would change this automatically.

Tangent, but I think there is an alias for find called firstOrNull. Kinda surprised there is no indexOfFirstOrNull, only indexOfFirst. indexOfFirst().takeIf { it >= 0 } would work around that I guess.

Anyway, no need to change to those, more that I nerd sniped myself. 😆

// Using contains on the displayable version of the ide means they can be as specific or as vague as they want
// CL 2023.3.6 233.15619.8 -> a specific Clion build
// CL 2023.3.6 -> a specific Clion version
Expand Down Expand Up @@ -483,9 +480,10 @@
layout = FlowLayout(FlowLayout.LEFT)
add(JLabel(ideWithStatus.product.ideName, ideWithStatus.product.icon, SwingConstants.LEFT))
add(
JLabel(displayIdeWithStatus(
ideWithStatus
),
JLabel(
displayIdeWithStatus(
ideWithStatus,
),
).apply {
foreground = UIUtil.getLabelDisabledForeground()
},
Expand Down
Loading