diff --git a/src/main/kotlin/io/snyk/plugin/settings/SnykProjectSettingsConfigurable.kt b/src/main/kotlin/io/snyk/plugin/settings/SnykProjectSettingsConfigurable.kt index f5e6986b5..18d9314cf 100644 --- a/src/main/kotlin/io/snyk/plugin/settings/SnykProjectSettingsConfigurable.kt +++ b/src/main/kotlin/io/snyk/plugin/settings/SnykProjectSettingsConfigurable.kt @@ -21,7 +21,7 @@ import io.snyk.plugin.ui.SnykSettingsDialog import snyk.common.lsp.LanguageServerWrapper import javax.swing.JComponent -class SnykProjectSettingsConfigurable( +open class SnykProjectSettingsConfigurable( val project: Project, ) : SearchableConfigurable { private val settingsStateService @@ -118,7 +118,7 @@ class SnykProjectSettingsConfigurable( } if (snykSettingsDialog.isNetNewIssuesSelected() != pluginSettings().netNewIssues) { - handleNetNewIssuesChanged() + settingsStateService.netNewIssues = snykSettingsDialog.isNetNewIssuesSelected() } LanguageServerWrapper.getInstance().updateConfiguration() @@ -162,10 +162,6 @@ class SnykProjectSettingsConfigurable( ) } - private fun handleNetNewIssuesChanged() { - settingsStateService.netNewIssues = snykSettingsDialog.isNetNewIssuesSelected() - } - private fun isTokenModified(): Boolean = snykSettingsDialog.getToken() != settingsStateService.token private fun isCustomEndpointModified(): Boolean = diff --git a/src/main/kotlin/io/snyk/plugin/ui/SnykSettingsDialog.kt b/src/main/kotlin/io/snyk/plugin/ui/SnykSettingsDialog.kt index f9b1ba160..56cea6ff5 100644 --- a/src/main/kotlin/io/snyk/plugin/ui/SnykSettingsDialog.kt +++ b/src/main/kotlin/io/snyk/plugin/ui/SnykSettingsDialog.kt @@ -205,7 +205,7 @@ class SnykSettingsDialog( } private fun initializeUiComponents() { - rootPanel.layout = UIGridLayoutManager(11, 1, JBUI.emptyInsets(), -1, -1) + rootPanel.layout = UIGridLayoutManager(10, 1, JBUI.emptyInsets(), -1, -1) /** General settings ------------------ */ @@ -574,9 +574,13 @@ class SnykSettingsDialog( newNewIssuesLabel.labelFor = netNewIssuesDropDown projectSettingsPanel.add( newNewIssuesLabel, - baseGridConstraintsAnchorWest( + baseGridConstraints( row = 5, + column = 0, + anchor = UIGridConstraints.ANCHOR_WEST, hSizePolicy = UIGridConstraints.SIZEPOLICY_CAN_SHRINK, + colSpan = 1, + indent = 0, ), ) @@ -603,7 +607,7 @@ class SnykSettingsDialog( rootPanel.add( userExperiencePanel, baseGridConstraints( - row = 7, + row = 6, anchor = UIGridConstraints.ANCHOR_NORTHWEST, fill = UIGridConstraints.FILL_HORIZONTAL, hSizePolicy = UIGridConstraints.SIZEPOLICY_CAN_SHRINK or UIGridConstraints.SIZEPOLICY_CAN_GROW, @@ -647,7 +651,7 @@ class SnykSettingsDialog( rootPanel.add( generalSettingsSpacer, panelGridConstraints( - row = 6, + row = 5, ), ) } diff --git a/src/main/kotlin/snyk/common/lsp/LanguageServerSettings.kt b/src/main/kotlin/snyk/common/lsp/LanguageServerSettings.kt index bc9512c62..9b331fa8e 100644 --- a/src/main/kotlin/snyk/common/lsp/LanguageServerSettings.kt +++ b/src/main/kotlin/snyk/common/lsp/LanguageServerSettings.kt @@ -42,9 +42,11 @@ data class LanguageServerSettings( @SerializedName("enableSnykOSSQuickFixCodeActions") val enableSnykOSSQuickFixCodeActions: String? = null, @SerializedName("requiredProtocolVersion") val requiredProtocolVersion: String = pluginSettings().requiredLsProtocolVersion.toString(), - @SerializedName("enableDeltaFindings") val enableDeltaFindings: String = (pluginSettings().netNewIssues == "Net new issues").toString() + @SerializedName("enableDeltaFindings") val enableDeltaFindings: String = isDeltaFindingsEnabled() ) +private fun isDeltaFindingsEnabled() = (pluginSettings().netNewIssues == "Net new issues").toString() + data class SeverityFilter( @SerializedName("critical") val critical: Boolean?, @SerializedName("high") val high: Boolean?, diff --git a/src/main/kotlin/snyk/common/lsp/LanguageServerWrapper.kt b/src/main/kotlin/snyk/common/lsp/LanguageServerWrapper.kt index 4f2d66b71..eb4329f7e 100644 --- a/src/main/kotlin/snyk/common/lsp/LanguageServerWrapper.kt +++ b/src/main/kotlin/snyk/common/lsp/LanguageServerWrapper.kt @@ -17,6 +17,7 @@ import io.snyk.plugin.getSnykTaskQueueService import io.snyk.plugin.getWaitForResultsTimeout import io.snyk.plugin.isSnykIaCLSEnabled import io.snyk.plugin.pluginSettings +import io.snyk.plugin.services.SnykApplicationSettingsStateService import io.snyk.plugin.toLanguageServerURL import io.snyk.plugin.ui.toolwindow.SnykPluginDisposable import kotlinx.coroutines.DelicateCoroutinesApi @@ -405,11 +406,13 @@ class LanguageServerWrapper( integrationVersion = pluginInfo.integrationVersion, authenticationMethod = authMethod, enableSnykOSSQuickFixCodeActions = "true", - enableDeltaFindings = (ps.netNewIssues == "Net new issues").toString(), - + enableDeltaFindings = isDeltaFindingsEnabled(ps), ) } + private fun isDeltaFindingsEnabled(ps: SnykApplicationSettingsStateService) = + (ps.netNewIssues == "Net new issues").toString() + fun updateConfiguration() { if (!ensureLanguageServerInitialized()) return val params = DidChangeConfigurationParams(getSettings())