Internal Kotlin packages now should be completable in parent packages
Internal packages which are hard-excluded from completion and imports now should be visible there if file package are parent of excluded one e.g kotlin.jvm.internal.* now visible from kotlin and kotlin.jvm #KT-16214 fixed
This commit is contained in:
@@ -58,7 +58,8 @@ class KotlinIndicesHelper(
|
||||
visibilityFilter: (DeclarationDescriptor) -> Boolean,
|
||||
private val declarationTranslator: (KtDeclaration) -> KtDeclaration? = { it },
|
||||
applyExcludeSettings: Boolean = true,
|
||||
private val filterOutPrivate: Boolean = true
|
||||
private val filterOutPrivate: Boolean = true,
|
||||
private val file: KtFile? = null
|
||||
) {
|
||||
|
||||
private val moduleDescriptor = resolutionFacade.moduleDescriptor
|
||||
@@ -68,7 +69,7 @@ class KotlinIndicesHelper(
|
||||
private val descriptorFilter: (DeclarationDescriptor) -> Boolean = filter@ {
|
||||
if (it.isHiddenInResolution(resolutionFacade.frontendService<LanguageVersionSettings>())) return@filter false
|
||||
if (!visibilityFilter(it)) return@filter false
|
||||
if (applyExcludeSettings && it.isExcludedFromAutoImport(project)) return@filter false
|
||||
if (applyExcludeSettings && it.isExcludedFromAutoImport(project, file)) return@filter false
|
||||
true
|
||||
}
|
||||
|
||||
|
||||
+6
-3
@@ -20,6 +20,7 @@ import com.intellij.codeInsight.JavaProjectCodeInsightSettings
|
||||
import com.intellij.openapi.project.Project
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.idea.imports.importableFqName
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
|
||||
|
||||
private val exclusions =
|
||||
@@ -30,10 +31,12 @@ private val exclusions =
|
||||
"kotlin.reflect.jvm.internal"
|
||||
)
|
||||
|
||||
private fun shouldBeHiddenAsInternalImplementationDetail(fqName: String) = exclusions.any { fqName.startsWith(it) }
|
||||
private fun shouldBeHiddenAsInternalImplementationDetail(fqName: String, locationFqName: String) =
|
||||
exclusions.any { fqName.startsWith(it) }
|
||||
&& (locationFqName.isBlank() || !fqName.startsWith(locationFqName))
|
||||
|
||||
fun DeclarationDescriptor.isExcludedFromAutoImport(project: Project): Boolean {
|
||||
fun DeclarationDescriptor.isExcludedFromAutoImport(project: Project, inFile: KtFile?): Boolean {
|
||||
val fqName = importableFqName?.asString() ?: return false
|
||||
return JavaProjectCodeInsightSettings.getSettings(project).isExcluded(fqName) ||
|
||||
shouldBeHiddenAsInternalImplementationDetail(fqName)
|
||||
shouldBeHiddenAsInternalImplementationDetail(fqName, inFile?.packageFqName?.asString() ?: "")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user