Debugger: Fix completion for synthetic '_field' extension properties (KT-23586)

This commit is contained in:
Yan Zhulanow
2019-03-19 20:31:11 +03:00
parent 0d04dc6f99
commit fb3efd2d78
12 changed files with 75 additions and 11 deletions
@@ -0,0 +1,34 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.idea.debugger.evaluate
import org.jetbrains.kotlin.descriptors.CallableDescriptor
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
import org.jetbrains.kotlin.idea.core.extension.KotlinIndicesHelperExtension
import org.jetbrains.kotlin.incremental.components.LookupLocation
import org.jetbrains.kotlin.incremental.components.LookupTracker
import org.jetbrains.kotlin.storage.LockBasedStorageManager
import org.jetbrains.kotlin.synthetic.JavaSyntheticPropertiesScope
import org.jetbrains.kotlin.types.KotlinType
class DebuggerFieldKotlinIndicesHelperExtension : KotlinIndicesHelperExtension {
override fun appendExtensionCallables(
consumer: MutableList<in CallableDescriptor>,
moduleDescriptor: ModuleDescriptor,
receiverTypes: Collection<KotlinType>,
nameFilter: (String) -> Boolean,
lookupLocation: LookupLocation
) {
val javaPropertiesScope = JavaSyntheticPropertiesScope(LockBasedStorageManager.NO_LOCKS, LookupTracker.DO_NOTHING)
val fieldScope = DebuggerFieldSyntheticScope(javaPropertiesScope)
for (property in fieldScope.getSyntheticExtensionProperties(receiverTypes, lookupLocation)) {
if (nameFilter(property.name.asString())) {
consumer += property
}
}
}
}
@@ -46,7 +46,7 @@ class DebuggerFieldSyntheticScopeProvider : SyntheticScopeProviderExtension {
}
}
private class DebuggerFieldSyntheticScope(val javaSyntheticPropertiesScope: JavaSyntheticPropertiesScope) : SyntheticScope.Default() {
class DebuggerFieldSyntheticScope(val javaSyntheticPropertiesScope: JavaSyntheticPropertiesScope) : SyntheticScope.Default() {
private val javaSourceElementFactory = JavaSourceElementFactoryImpl()
override fun getSyntheticExtensionProperties(