Collect local declarations under properties (KT-14215); improve presentation of object declarations
#KT-14215 Fixed
This commit is contained in:
+5
@@ -29,6 +29,7 @@ import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.idea.KotlinDescriptorIconProvider
|
||||
import org.jetbrains.kotlin.psi.KtAnonymousInitializer
|
||||
import org.jetbrains.kotlin.psi.KtModifierListOwner
|
||||
import org.jetbrains.kotlin.psi.KtObjectDeclaration
|
||||
import org.jetbrains.kotlin.psi.KtPsiUtil
|
||||
import org.jetbrains.kotlin.renderer.DescriptorRenderer.Companion.ONLY_NAMES_WITH_SHORT_TYPES
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils.getAllOverriddenDeclarations
|
||||
@@ -82,6 +83,10 @@ internal class KotlinStructureElementPresentation(
|
||||
}
|
||||
|
||||
private fun getElementText(navigatablePsiElement: NavigatablePsiElement, descriptor: DeclarationDescriptor?): String? {
|
||||
if (navigatablePsiElement is KtObjectDeclaration && navigatablePsiElement.isObjectLiteral()) {
|
||||
return "object" + (navigatablePsiElement.getSuperTypeList()?.text?.let { " : $it" } ?: "")
|
||||
}
|
||||
|
||||
if (descriptor != null) {
|
||||
return ONLY_NAMES_WITH_SHORT_TYPES.render(descriptor)
|
||||
}
|
||||
|
||||
+1
-1
@@ -90,7 +90,7 @@ class KotlinStructureViewElement(val element: NavigatablePsiElement,
|
||||
is KtFile -> element.declarations
|
||||
is KtClass -> element.getStructureDeclarations()
|
||||
is KtClassOrObject -> element.declarations
|
||||
is KtFunction, is KtClassInitializer -> element.collectLocalDeclarations()
|
||||
is KtFunction, is KtClassInitializer, is KtProperty -> element.collectLocalDeclarations()
|
||||
else -> emptyList()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user