diff --git a/src/main/kotlin/io/snyk/plugin/snykcode/SnykCodeBulkFileListener.kt b/src/main/kotlin/io/snyk/plugin/snykcode/SnykCodeBulkFileListener.kt index bf817dd8c..e0d52cdce 100644 --- a/src/main/kotlin/io/snyk/plugin/snykcode/SnykCodeBulkFileListener.kt +++ b/src/main/kotlin/io/snyk/plugin/snykcode/SnykCodeBulkFileListener.kt @@ -71,7 +71,7 @@ class SnykCodeBulkFileListener : SnykBulkFileListener() { val filesAffected = toSnykCodeFileSet(project, virtualFilesAffected) if (isSnykCodeLSEnabled()) { - processAfterForLS(filesAffected, project) + updateCacheAndUI(filesAffected, project) return } /* update .dcignore caches if needed */ @@ -98,7 +98,7 @@ class SnykCodeBulkFileListener : SnykBulkFileListener() { } } - private fun processAfterForLS(filesAffected: Set, project: Project) { + private fun updateCacheAndUI(filesAffected: Set, project: Project) { val cache = getSnykCachedResults(project)?.currentSnykCodeResultsLS ?: return filesAffected.forEach { cache.remove(it) diff --git a/src/main/kotlin/io/snyk/plugin/ui/toolwindow/SnykToolWindowSnykCodeScanListenerLS.kt b/src/main/kotlin/io/snyk/plugin/ui/toolwindow/SnykToolWindowSnykCodeScanListenerLS.kt index e2fd8d1e4..7b91e8995 100644 --- a/src/main/kotlin/io/snyk/plugin/ui/toolwindow/SnykToolWindowSnykCodeScanListenerLS.kt +++ b/src/main/kotlin/io/snyk/plugin/ui/toolwindow/SnykToolWindowSnykCodeScanListenerLS.kt @@ -67,7 +67,7 @@ class SnykToolWindowSnykCodeScanListenerLS( .map { it.key to it.value.filter { issue -> issue.additionalData.isSecurityType } } .toMap() securityIssuesCount = securityResults.values.flatten().distinct().size - securityIssuesHMLPostfix = buildHMLpostfix(securityResults) + securityIssuesHMLPostfix = buildSeveritiesPostfixForFileNode(securityResults) if (pluginSettings().treeFiltering.codeSecurityResults) { val securityResultsToDisplay = securityResults.map { entry -> @@ -103,7 +103,7 @@ class SnykToolWindowSnykCodeScanListenerLS( .map { it.key to it.value.filter { issue -> !issue.additionalData.isSecurityType } } .toMap() qualityIssuesCount = qualityResults.values.flatten().distinct().size - qualityIssuesHMLPostfix = buildHMLpostfix(qualityResults) + qualityIssuesHMLPostfix = buildSeveritiesPostfixForFileNode(qualityResults) if (pluginSettings().treeFiltering.codeQualityResults) { val qualityResultsToDisplay = qualityResults.map { entry -> @@ -157,7 +157,7 @@ class SnykToolWindowSnykCodeScanListenerLS( } } - private fun buildHMLpostfix(securityResults: Map>): String { + private fun buildSeveritiesPostfixForFileNode(securityResults: Map>): String { val high = securityResults.values.flatten().count { it.getSeverityAsEnum() == Severity.HIGH } val medium = securityResults.values.flatten().count { it.getSeverityAsEnum() == Severity.MEDIUM } val low = securityResults.values.flatten().count { it.getSeverityAsEnum() == Severity.LOW } diff --git a/src/main/kotlin/snyk/common/SnykCachedResults.kt b/src/main/kotlin/snyk/common/SnykCachedResults.kt index 4c7fd2367..e38d30aca 100644 --- a/src/main/kotlin/snyk/common/SnykCachedResults.kt +++ b/src/main/kotlin/snyk/common/SnykCachedResults.kt @@ -49,7 +49,7 @@ class SnykCachedResults(val project: Project) { currentOssError = null currentContainerError = null currentIacError = null -// currentSnykCodeResultsLS = null + currentSnykCodeResultsLS.clear() currentSnykCodeResults = null currentSnykCodeError = null } @@ -125,7 +125,7 @@ class SnykCachedResults(val project: Project) { object : SnykCodeScanListenerLS { val logger = logger() override fun scanningStarted(snykScan: SnykScanParams) { - logger.info("scanningStarted for project ${project.name}, emptying cache.") + logger.info("scanningStarted for project ${project.name}") } override fun scanningSnykCodeFinished(snykCodeResults: Map>) {