FIR IDE: find source of deserialized enum entry
This commit is contained in:
+12
@@ -32,6 +32,7 @@ object FirIdeDeserializedDeclarationSourceProvider {
|
||||
is FirClass -> provideSourceForClass(fir, project)
|
||||
is FirTypeAlias -> provideSourceForTypeAlias(fir, project)
|
||||
is FirConstructor -> provideSourceForConstructor(fir, project)
|
||||
is FirEnumEntry -> provideSourceForEnumEntry(fir, project)
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
@@ -97,6 +98,17 @@ object FirIdeDeserializedDeclarationSourceProvider {
|
||||
return null
|
||||
}
|
||||
|
||||
private fun provideSourceForEnumEntry(
|
||||
enumEntry: FirEnumEntry,
|
||||
project: Project
|
||||
): PsiElement? {
|
||||
val candidates = enumEntry.containingKtClass(project)?.body?.enumEntries
|
||||
?.filter { it.name == enumEntry.name.asString() }
|
||||
.orEmpty()
|
||||
|
||||
return candidates.firstOrNull(KtElement::isCompiled)
|
||||
}
|
||||
|
||||
private fun FirDeclaration.scope(project: Project): GlobalSearchScope {
|
||||
return GlobalSearchScope.allScope(project)
|
||||
/* TODO:
|
||||
|
||||
Reference in New Issue
Block a user