Do not highlight completion variants from nullable receiver with grey in Evaluate Expression Dialog

#KT-11578 Fixed
This commit is contained in:
Natalia Ukhorskaya
2016-03-31 12:59:58 +03:00
parent 4d8673d097
commit 8b6a447e68
3 changed files with 5 additions and 5 deletions
@@ -247,7 +247,7 @@ class BasicCompletionSession(
completeNonImported(lookupElementFactory)
flushToResultSet()
if (position.containingFile is KtCodeFragment) {
if (isDebuggerContext) {
val variantsAndFactory = getRuntimeReceiverTypeReferenceVariants(lookupElementFactory)
if (variantsAndFactory != null) {
val variants = variantsAndFactory.first
@@ -78,6 +78,7 @@ abstract class CompletionSession(
protected val moduleDescriptor = resolutionFacade.moduleDescriptor
protected val project = position.project
protected val isJvmModule = !ProjectStructureUtil.isJsKotlinModule(parameters.originalFile as KtFile)
protected val isDebuggerContext = file is KtCodeFragment
protected val nameExpression: KtSimpleNameExpression?
protected val expression: KtExpression?
@@ -191,7 +192,7 @@ abstract class CompletionSession(
if (descriptor is DeclarationDescriptorWithVisibility) {
val visible = descriptor.isVisible(position, callTypeAndReceiver.receiver as? KtExpression, bindingContext, resolutionFacade)
if (visible) return true
return completeNonAccessible && (!descriptor.isFromLibrary() || file is KtCodeFragment)
return completeNonAccessible && (!descriptor.isFromLibrary() || isDebuggerContext)
}
return true
@@ -450,7 +451,7 @@ abstract class CompletionSession(
bindingContext, nameExpression, moduleDescriptor, resolutionFacade,
predictableSmartCastsOnly = true /* we don't include smart cast receiver types for "unpredictable" receiver value to mark members grayed */)
if (callTypeAndReceiver is CallTypeAndReceiver.SAFE) {
if (callTypeAndReceiver is CallTypeAndReceiver.SAFE || isDebuggerContext) {
receiverTypes = receiverTypes!!.map { it.makeNotNullable() }
}
@@ -30,7 +30,6 @@ import org.jetbrains.kotlin.idea.core.completion.DeclarationLookupObject
import org.jetbrains.kotlin.idea.util.CallTypeAndReceiver
import org.jetbrains.kotlin.load.java.descriptors.SamConstructorDescriptorKindExclude
import org.jetbrains.kotlin.psi.LambdaArgument
import org.jetbrains.kotlin.psi.KtCodeFragment
import org.jetbrains.kotlin.psi.ValueArgumentName
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.calls.callUtil.getCall
@@ -140,7 +139,7 @@ class SmartCompletionSession(
}
}
if (position.containingFile is KtCodeFragment) {
if (isDebuggerContext) {
val variantsAndFactory = getRuntimeReceiverTypeReferenceVariants(lookupElementFactory)
if (variantsAndFactory != null) {
val variants = variantsAndFactory.first