diff --git a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/BasicCompletionSession.kt b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/BasicCompletionSession.kt index 70ccecaba3e..820234c7e86 100644 --- a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/BasicCompletionSession.kt +++ b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/BasicCompletionSession.kt @@ -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 diff --git a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/CompletionSession.kt b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/CompletionSession.kt index 76bbbcc2db8..7f77dfd7431 100644 --- a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/CompletionSession.kt +++ b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/CompletionSession.kt @@ -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() } } diff --git a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/smart/SmartCompletionSession.kt b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/smart/SmartCompletionSession.kt index 52727a9753b..c6d31f3aca2 100644 --- a/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/smart/SmartCompletionSession.kt +++ b/idea/idea-completion/src/org/jetbrains/kotlin/idea/completion/smart/SmartCompletionSession.kt @@ -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