diff --git a/src/intellij-compat/src/232/compat/com/intellij/compat/codeInsight/navigation/impl/PsiTargetPresentationRenderer.kt b/src/intellij-compat/src/232/compat/com/intellij/compat/codeInsight/navigation/impl/PsiTargetPresentationRenderer.kt index 72156517d5..318855d89e 100644 --- a/src/intellij-compat/src/232/compat/com/intellij/compat/codeInsight/navigation/impl/PsiTargetPresentationRenderer.kt +++ b/src/intellij-compat/src/232/compat/com/intellij/compat/codeInsight/navigation/impl/PsiTargetPresentationRenderer.kt @@ -1,7 +1,9 @@ // Copyright (C) 2024 Reece H. Dunn. SPDX-License-Identifier: Apache-2.0 package com.intellij.compat.codeInsight.navigation.impl +import com.intellij.codeInsight.navigation.NavigationGutterIconBuilder import com.intellij.ide.util.PsiElementListCellRenderer +import com.intellij.openapi.util.Computable import com.intellij.openapi.util.NlsSafe import com.intellij.psi.PsiElement import org.jetbrains.annotations.Nls @@ -18,3 +20,7 @@ abstract class PsiTargetPresentationRenderer : PsiElementListCel abstract override fun getIcon(element: PsiElement): Icon? } + +fun NavigationGutterIconBuilder.setTargetRenderer( + renderer: Computable> +): NavigationGutterIconBuilder = setCellRenderer { renderer.compute() } diff --git a/src/plugin-marklogic/main/uk/co/reecedunn/intellij/plugin/marklogic/rewriter/navigation/RewriterLineMarkerProvider.kt b/src/plugin-marklogic/main/uk/co/reecedunn/intellij/plugin/marklogic/rewriter/navigation/RewriterLineMarkerProvider.kt index c2b34dc91d..fa9a122702 100644 --- a/src/plugin-marklogic/main/uk/co/reecedunn/intellij/plugin/marklogic/rewriter/navigation/RewriterLineMarkerProvider.kt +++ b/src/plugin-marklogic/main/uk/co/reecedunn/intellij/plugin/marklogic/rewriter/navigation/RewriterLineMarkerProvider.kt @@ -4,6 +4,7 @@ package uk.co.reecedunn.intellij.plugin.marklogic.rewriter.navigation import com.intellij.codeInsight.daemon.LineMarkerInfo import com.intellij.codeInsight.daemon.LineMarkerProvider import com.intellij.codeInsight.navigation.NavigationGutterIconBuilder +import com.intellij.compat.codeInsight.navigation.impl.* import com.intellij.psi.PsiElement import com.intellij.psi.impl.source.tree.LeafElement import uk.co.reecedunn.intellij.plugin.marklogic.resources.MarkLogicIcons @@ -23,7 +24,7 @@ class RewriterLineMarkerProvider : LineMarkerProvider { return NavigationGutterIconBuilder.create(MarkLogicIcons.Markers.Endpoint) .setTargets(endpoints.map { it.endpoint }) .setTooltipText(PluginApiBundle.message("line-marker.rewriter-endpoint.tooltip-text")) - .setTargetRenderer { RewriterListCellRenderer(endpoints) } + .setTargetRenderer { RewriterListCellRenderer(endpoints) as PsiTargetPresentationRenderer } .createLineMarkerInfo(element) } diff --git a/src/plugin-marklogic/main/uk/co/reecedunn/intellij/plugin/marklogic/search/options/navigation/CustomConstraintLineMarkerProvider.kt b/src/plugin-marklogic/main/uk/co/reecedunn/intellij/plugin/marklogic/search/options/navigation/CustomConstraintLineMarkerProvider.kt index 6b6df7d271..80bab59eec 100644 --- a/src/plugin-marklogic/main/uk/co/reecedunn/intellij/plugin/marklogic/search/options/navigation/CustomConstraintLineMarkerProvider.kt +++ b/src/plugin-marklogic/main/uk/co/reecedunn/intellij/plugin/marklogic/search/options/navigation/CustomConstraintLineMarkerProvider.kt @@ -4,6 +4,7 @@ package uk.co.reecedunn.intellij.plugin.marklogic.search.options.navigation import com.intellij.codeInsight.daemon.LineMarkerInfo import com.intellij.codeInsight.daemon.LineMarkerProvider import com.intellij.codeInsight.navigation.NavigationGutterIconBuilder +import com.intellij.compat.codeInsight.navigation.impl.* import com.intellij.psi.PsiElement import uk.co.reecedunn.intellij.plugin.marklogic.search.options.SearchOptions import uk.co.reecedunn.intellij.plugin.marklogic.search.options.reference.CustomConstraintFunctionReference @@ -26,7 +27,7 @@ class CustomConstraintLineMarkerProvider : LineMarkerProvider { return NavigationGutterIconBuilder.create(CustomConstraintFunctionReference.getIcon(facets[0].referenceType)) .setTargets(facets.map { it.element }) .setTooltipText(PluginApiBundle.message("line-marker.search-constraint.tooltip-text")) - .setTargetRenderer { CustomConstraintListCellRenderer(facets) } + .setTargetRenderer { CustomConstraintListCellRenderer(facets) as PsiTargetPresentationRenderer } .createLineMarkerInfo(element) } }