Icon (@NotNull DeclarationDescriptor descriptor) { if (descriptor instanceof PackageFragmentDescriptor || descriptor instanceof PackageViewDescriptor) { return AllIcons.Nodes.Package; } if (descriptor instanceof FunctionDescriptor functionDescriptor) { if (functionDescriptor.getExtensionReceiverParameter() != null) { return Modality.ABSTRACT == getModalitySafe(functionDescriptor) ? KotlinIcons.ABSTRACT_EXTENSION_FUNCTION : KotlinIcons.EXTENSION_FUNCTION; } if (descriptor.getContainingDeclaration() instanceof ClassDescriptor) { return Modality.ABSTRACT == getModalitySafe(functionDescriptor) ? PlatformIcons.ABSTRACT_METHOD_ICON : IconManager.getInstance().getPlatformIcon(com.intellij.ui.PlatformIcons.Method); } else { return KotlinIcons.FUNCTION; } } if (descriptor instanceof ClassDescriptor classDescriptor) { return switch (classDescriptor.getKind()) { case INTERFACE -> KotlinIcons.INTERFACE; case ENUM_CLASS, ENUM_ENTRY -> KotlinIcons.ENUM; case ANNOTATION_CLASS -> KotlinIcons.ANNOTATION; case OBJECT -> KotlinIcons.OBJECT; case CLASS -> Modality.ABSTRACT == getModalitySafe(classDescriptor) ? KotlinIcons.ABSTRACT_CLASS : KotlinIcons.CLASS; }; } if (descriptor instanceof ValueParameterDescriptor) { return KotlinIcons.PARAMETER; } if (descriptor instanceof LocalVariableDescriptor) { return ((VariableDescriptor) descriptor).isVar() ? KotlinIcons.VAR : KotlinIcons.VAL; } if (descriptor instanceof PropertyDescriptor) { return ((VariableDescriptor) descriptor).isVar() ? KotlinIcons.FIELD_VAR : KotlinIcons.FIELD_VAL; } if (descriptor instanceof TypeParameterDescriptor) { return IconManager.getInstance().getPlatformIcon(com.intellij.ui.PlatformIcons.Class); } if (descriptor instanceof TypeAliasDescriptor) { return KotlinIcons.TYPE_ALIAS; } LOG.warn("No icon for descriptor: " + descriptor); return null; }