KT-10621 Non-top level packages shown after "@" in completion
#KT-10621 Fixed
This commit is contained in:
@@ -56,7 +56,10 @@ class AllUnderImportScope(
|
|||||||
{ it !in excludedNames && nameFilter(it) }
|
{ it !in excludedNames && nameFilter(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
return scopes.flatMap { it.getContributedDescriptors(kindFilter, nameFilterToUse) }
|
val noPackagesKindFilter = kindFilter.withoutKinds(DescriptorKindFilter.PACKAGES_MASK)
|
||||||
|
return scopes
|
||||||
|
.flatMap { it.getContributedDescriptors(noPackagesKindFilter, nameFilterToUse) }
|
||||||
|
.filter { it !is PackageViewDescriptor } // subpackages are not imported
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getContributedClassifier(name: Name, location: LookupLocation): ClassifierDescriptor? {
|
override fun getContributedClassifier(name: Name, location: LookupLocation): ClassifierDescriptor? {
|
||||||
|
|||||||
@@ -28,8 +28,10 @@ import org.jetbrains.kotlin.resolve.BindingTrace
|
|||||||
import org.jetbrains.kotlin.resolve.QualifiedExpressionResolver
|
import org.jetbrains.kotlin.resolve.QualifiedExpressionResolver
|
||||||
import org.jetbrains.kotlin.resolve.TemporaryBindingTrace
|
import org.jetbrains.kotlin.resolve.TemporaryBindingTrace
|
||||||
import org.jetbrains.kotlin.resolve.bindingContextUtil.recordScope
|
import org.jetbrains.kotlin.resolve.bindingContextUtil.recordScope
|
||||||
import org.jetbrains.kotlin.resolve.scopes.*
|
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
|
||||||
import org.jetbrains.kotlin.resolve.scopes.utils.memberScopeAsImportingScope
|
import org.jetbrains.kotlin.resolve.scopes.ImportingScope
|
||||||
|
import org.jetbrains.kotlin.resolve.scopes.LexicalScope
|
||||||
|
import org.jetbrains.kotlin.resolve.scopes.SubpackagesImportingScope
|
||||||
import org.jetbrains.kotlin.resolve.source.KotlinSourceElement
|
import org.jetbrains.kotlin.resolve.source.KotlinSourceElement
|
||||||
import org.jetbrains.kotlin.storage.StorageManager
|
import org.jetbrains.kotlin.storage.StorageManager
|
||||||
import org.jetbrains.kotlin.storage.getValue
|
import org.jetbrains.kotlin.storage.getValue
|
||||||
@@ -177,7 +179,10 @@ open class FileScopeProviderImpl(
|
|||||||
override fun getContributedDescriptors(kindFilter: DescriptorKindFilter, nameFilter: (Name) -> Boolean): Collection<DeclarationDescriptor> {
|
override fun getContributedDescriptors(kindFilter: DescriptorKindFilter, nameFilter: (Name) -> Boolean): Collection<DeclarationDescriptor> {
|
||||||
// we do not perform any filtering by visibility here because all descriptors from both visible/invisible filter scopes are to be added anyway
|
// we do not perform any filtering by visibility here because all descriptors from both visible/invisible filter scopes are to be added anyway
|
||||||
if (filteringKind == FilteringKind.INVISIBLE_CLASSES) return listOf()
|
if (filteringKind == FilteringKind.INVISIBLE_CLASSES) return listOf()
|
||||||
return scope.getContributedDescriptors(kindFilter, { name -> name !in excludedNames && nameFilter(name) })
|
return scope.getContributedDescriptors(
|
||||||
|
kindFilter.withoutKinds(DescriptorKindFilter.PACKAGES_MASK),
|
||||||
|
{ name -> name !in excludedNames && nameFilter(name) }
|
||||||
|
).filter { it !is PackageViewDescriptor } // subpackages of the current package not accessible by the short name
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun toString() = "Scope for current package (${filteringKind.name})"
|
override fun toString() = "Scope for current package (${filteringKind.name})"
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
package java
|
||||||
|
|
||||||
annotation class Hello
|
annotation class Hello
|
||||||
val v = 1
|
val v = 1
|
||||||
|
|
||||||
@@ -8,3 +10,7 @@ val v = 1
|
|||||||
// EXIST: Suppress
|
// EXIST: Suppress
|
||||||
// ABSENT: String
|
// ABSENT: String
|
||||||
// ABSENT: v
|
// ABSENT: v
|
||||||
|
// EXIST: kotlin
|
||||||
|
// ABSENT: collections
|
||||||
|
// ABSENT: io
|
||||||
|
// ABSENT: lang
|
||||||
|
|||||||
Reference in New Issue
Block a user