diff --git a/CHANGELOG.md b/CHANGELOG.md index 83f76b4..f6be875 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ # Code Complexity Changelog +## [1.5.2] +- Fixed issue #18. Now complexity hints are visible only in the MAIN editor. + ## [1.5.1] - Support for IDEA 2024.2.EAP diff --git a/gradle.properties b/gradle.properties index caa7130..7e18339 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ pluginGroup = com.github.nikolaikopernik.codecomplexity pluginName = code-complexity-plugin pluginRepositoryUrl = https://github.com/nikolaikopernik/code-complexity-plugin # SemVer format -> https://semver.org -pluginVersion = 1.5.1 +pluginVersion = 1.5.2 # Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html pluginSinceBuild = 233 diff --git a/src/main/kotlin/com/github/nikolaikopernik/codecomplexity/ui/ComplexityInlayHintsProvider.kt b/src/main/kotlin/com/github/nikolaikopernik/codecomplexity/ui/ComplexityInlayHintsProvider.kt index 0b2fc6d..ad8587a 100644 --- a/src/main/kotlin/com/github/nikolaikopernik/codecomplexity/ui/ComplexityInlayHintsProvider.kt +++ b/src/main/kotlin/com/github/nikolaikopernik/codecomplexity/ui/ComplexityInlayHintsProvider.kt @@ -11,16 +11,25 @@ import com.intellij.codeInsight.hints.InlayHintsSink import com.intellij.codeInsight.hints.NoSettings import com.intellij.codeInsight.hints.SettingsKey import com.intellij.lang.Language +import com.intellij.openapi.diagnostic.LoggerRt import com.intellij.openapi.editor.Editor +import com.intellij.openapi.editor.EditorKind import com.intellij.psi.PsiFile import javax.swing.JPanel @Suppress("UnstableApiUsage") class ComplexityInlayHintsProvider(private val complexityInfoProvider: ComplexityInfoProvider) : InlayHintsProvider { + + private val logger = LoggerRt.getInstance(ComplexityInlayHintsProvider::class.java) + override fun getCollectorFor(file: PsiFile, editor: Editor, settings: NoSettings, - sink: InlayHintsSink): InlayHintsCollector { + sink: InlayHintsSink): InlayHintsCollector? { + if (editor.editorKind != EditorKind.MAIN_EDITOR) { + // we don't want to show hint in all the possible editors, only in MAIN + return null + } return ComplexityFactoryInlayHintsCollector(complexityInfoProvider, editor) }