Do not highlight completion variants from nullable receiver with grey in Evaluate Expression Dialog
#KT-11578 Fixed
This commit is contained in:
+1
-1
@@ -247,7 +247,7 @@ class BasicCompletionSession(
|
|||||||
completeNonImported(lookupElementFactory)
|
completeNonImported(lookupElementFactory)
|
||||||
flushToResultSet()
|
flushToResultSet()
|
||||||
|
|
||||||
if (position.containingFile is KtCodeFragment) {
|
if (isDebuggerContext) {
|
||||||
val variantsAndFactory = getRuntimeReceiverTypeReferenceVariants(lookupElementFactory)
|
val variantsAndFactory = getRuntimeReceiverTypeReferenceVariants(lookupElementFactory)
|
||||||
if (variantsAndFactory != null) {
|
if (variantsAndFactory != null) {
|
||||||
val variants = variantsAndFactory.first
|
val variants = variantsAndFactory.first
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ abstract class CompletionSession(
|
|||||||
protected val moduleDescriptor = resolutionFacade.moduleDescriptor
|
protected val moduleDescriptor = resolutionFacade.moduleDescriptor
|
||||||
protected val project = position.project
|
protected val project = position.project
|
||||||
protected val isJvmModule = !ProjectStructureUtil.isJsKotlinModule(parameters.originalFile as KtFile)
|
protected val isJvmModule = !ProjectStructureUtil.isJsKotlinModule(parameters.originalFile as KtFile)
|
||||||
|
protected val isDebuggerContext = file is KtCodeFragment
|
||||||
|
|
||||||
protected val nameExpression: KtSimpleNameExpression?
|
protected val nameExpression: KtSimpleNameExpression?
|
||||||
protected val expression: KtExpression?
|
protected val expression: KtExpression?
|
||||||
@@ -191,7 +192,7 @@ abstract class CompletionSession(
|
|||||||
if (descriptor is DeclarationDescriptorWithVisibility) {
|
if (descriptor is DeclarationDescriptorWithVisibility) {
|
||||||
val visible = descriptor.isVisible(position, callTypeAndReceiver.receiver as? KtExpression, bindingContext, resolutionFacade)
|
val visible = descriptor.isVisible(position, callTypeAndReceiver.receiver as? KtExpression, bindingContext, resolutionFacade)
|
||||||
if (visible) return true
|
if (visible) return true
|
||||||
return completeNonAccessible && (!descriptor.isFromLibrary() || file is KtCodeFragment)
|
return completeNonAccessible && (!descriptor.isFromLibrary() || isDebuggerContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
@@ -450,7 +451,7 @@ abstract class CompletionSession(
|
|||||||
bindingContext, nameExpression, moduleDescriptor, resolutionFacade,
|
bindingContext, nameExpression, moduleDescriptor, resolutionFacade,
|
||||||
predictableSmartCastsOnly = true /* we don't include smart cast receiver types for "unpredictable" receiver value to mark members grayed */)
|
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() }
|
receiverTypes = receiverTypes!!.map { it.makeNotNullable() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -30,7 +30,6 @@ import org.jetbrains.kotlin.idea.core.completion.DeclarationLookupObject
|
|||||||
import org.jetbrains.kotlin.idea.util.CallTypeAndReceiver
|
import org.jetbrains.kotlin.idea.util.CallTypeAndReceiver
|
||||||
import org.jetbrains.kotlin.load.java.descriptors.SamConstructorDescriptorKindExclude
|
import org.jetbrains.kotlin.load.java.descriptors.SamConstructorDescriptorKindExclude
|
||||||
import org.jetbrains.kotlin.psi.LambdaArgument
|
import org.jetbrains.kotlin.psi.LambdaArgument
|
||||||
import org.jetbrains.kotlin.psi.KtCodeFragment
|
|
||||||
import org.jetbrains.kotlin.psi.ValueArgumentName
|
import org.jetbrains.kotlin.psi.ValueArgumentName
|
||||||
import org.jetbrains.kotlin.resolve.BindingContext
|
import org.jetbrains.kotlin.resolve.BindingContext
|
||||||
import org.jetbrains.kotlin.resolve.calls.callUtil.getCall
|
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)
|
val variantsAndFactory = getRuntimeReceiverTypeReferenceVariants(lookupElementFactory)
|
||||||
if (variantsAndFactory != null) {
|
if (variantsAndFactory != null) {
|
||||||
val variants = variantsAndFactory.first
|
val variants = variantsAndFactory.first
|
||||||
|
|||||||
Reference in New Issue
Block a user