Include in MethodInfo only names of arguments actually in the call
Needed to apply blacklist for e.g. startsWith more correctly.
This commit is contained in:
+11
-4
@@ -38,6 +38,7 @@ import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
||||
import org.jetbrains.kotlin.renderer.DescriptorRenderer
|
||||
import org.jetbrains.kotlin.renderer.RenderingFormat
|
||||
import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
|
||||
import org.jetbrains.kotlin.resolve.calls.model.DefaultValueArgument
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameOrNull
|
||||
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode
|
||||
|
||||
@@ -210,10 +211,16 @@ class KotlinInlayParameterHintsProvider : InlayParameterHintsProvider {
|
||||
|
||||
private fun getMethodInfo(elem: KtCallExpression): HintInfo.MethodInfo? {
|
||||
val ctx = elem.analyze(BodyResolveMode.PARTIAL)
|
||||
val resolvedCall = elem.getResolvedCall(ctx)?.candidateDescriptor
|
||||
if (resolvedCall is FunctionDescriptor) {
|
||||
val fqName = resolvedCall.fqNameOrNull()?.asString() ?: return null
|
||||
val paramNames = resolvedCall.valueParameters.map { it.name }.filter { !it.isSpecial }.map(Name::asString)
|
||||
val resolvedCall = elem.getResolvedCall(ctx)
|
||||
val resolvedCallee = resolvedCall?.candidateDescriptor
|
||||
if (resolvedCallee is FunctionDescriptor) {
|
||||
val fqName = resolvedCallee.fqNameOrNull()?.asString() ?: return null
|
||||
val paramNames = resolvedCall.valueArguments
|
||||
.mapNotNull { (valueParameterDescriptor, resolvedValueArgument) ->
|
||||
if (resolvedValueArgument !is DefaultValueArgument) valueParameterDescriptor.name else null
|
||||
}
|
||||
.filter { !it.isSpecial }
|
||||
.map(Name::asString)
|
||||
return HintInfo.MethodInfo(fqName, paramNames)
|
||||
}
|
||||
return null
|
||||
|
||||
Reference in New Issue
Block a user