From e363e9c2e06f79fbd658e04b8ae998e00cc24fd6 Mon Sep 17 00:00:00 2001 From: Bastian Doetsch Date: Wed, 17 Jan 2024 08:20:16 -0500 Subject: [PATCH] fix: remove kotlin specific code that could fail in non-kotlin IDEs (#466) * chore: remove intellij specific config/code * docs: update CHANGELOG.md * chore: re-add kotlin plugin to platform plugins --- CHANGELOG.md | 4 +++ build.gradle.kts | 3 +- .../ui/toolwindow/SnykTreeCellRenderer.kt | 31 +++++++++++-------- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a22e02fe..4202712a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Snyk Changelog +## [2.6.1] +### Fixed +- remove more intellij-specific code and configuration + ## [2.6.1] ### Fixed - don't use kotlin library on non-kotlin IDEs diff --git a/build.gradle.kts b/build.gradle.kts index efb390f6c..d4bfdf8a2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -70,7 +70,8 @@ dependencies { // read more: https://github.com/JetBrains/gradle-intellij-plugin intellij { version.set(properties("platformVersion")) - + // https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#intellij-extension-type + // type.set("GO") downloadSources.set(properties("platformDownloadSources").toBoolean()) // plugin dependencies: uses `platformPlugins` property from the gradle.properties file. diff --git a/src/main/kotlin/io/snyk/plugin/ui/toolwindow/SnykTreeCellRenderer.kt b/src/main/kotlin/io/snyk/plugin/ui/toolwindow/SnykTreeCellRenderer.kt index 91bdf833f..3b54352a7 100644 --- a/src/main/kotlin/io/snyk/plugin/ui/toolwindow/SnykTreeCellRenderer.kt +++ b/src/main/kotlin/io/snyk/plugin/ui/toolwindow/SnykTreeCellRenderer.kt @@ -24,7 +24,6 @@ import io.snyk.plugin.ui.toolwindow.nodes.root.RootSecurityIssuesTreeNode import io.snyk.plugin.ui.toolwindow.nodes.secondlevel.ErrorTreeNode import io.snyk.plugin.ui.toolwindow.nodes.secondlevel.FileTreeNode import io.snyk.plugin.ui.toolwindow.nodes.secondlevel.SnykCodeFileTreeNode -import org.jetbrains.kotlin.idea.base.util.letIf import snyk.common.ProductType import snyk.common.SnykError import snyk.container.ContainerIssue @@ -73,10 +72,12 @@ class SnykTreeCellRenderer : ColoredTreeCellRenderer() { append(fileVulns.sanitizedTargetFile) append(ProductType.OSS.getCountText(value.childCount)) } - text = toolTipText.letIf(toolTipText.length > MAX_FILE_TREE_NODE_LENGTH) { - "..." + it.substring( - it.length - MAX_FILE_TREE_NODE_LENGTH, it.length - ) + text = toolTipText.apply { + if (toolTipText.length > MAX_FILE_TREE_NODE_LENGTH) { + "..." + this.substring( + this.length - MAX_FILE_TREE_NODE_LENGTH, this.length + ) + } } val snykCachedResults = getSnykCachedResults(value.project) @@ -111,10 +112,12 @@ class SnykTreeCellRenderer : ColoredTreeCellRenderer() { append(productType.getCountText(value.childCount)) } - text = toolTipText.letIf(toolTipText.length > MAX_FILE_TREE_NODE_LENGTH) { - "..." + it.substring( - it.length - MAX_FILE_TREE_NODE_LENGTH, it.length - ) + text = toolTipText.apply { + if (toolTipText.length > MAX_FILE_TREE_NODE_LENGTH) { + "..." + this.substring( + this.length - MAX_FILE_TREE_NODE_LENGTH, this.length + ) + } } nodeIcon = file.icon @@ -137,10 +140,12 @@ class SnykTreeCellRenderer : ColoredTreeCellRenderer() { append(ProductType.IAC.getCountText(value.childCount)) } - text = toolTipText.letIf(toolTipText.length > MAX_FILE_TREE_NODE_LENGTH) { - "..." + it.substring( - it.length - MAX_FILE_TREE_NODE_LENGTH, it.length - ) + text = toolTipText.apply { + if (toolTipText.length > MAX_FILE_TREE_NODE_LENGTH) { + "..." + this.substring( + this.length - MAX_FILE_TREE_NODE_LENGTH, this.length + ) + } } val snykCachedResults = getSnykCachedResults(value.project)