I’m trying to get a KSFunctionDeclaration with get...
# ksp
j
I’m trying to get a KSFunctionDeclaration with getFunctionDeclarationsByName :
Copy code
package com.my.package

fun testFunction() = ...
An in my ksp processor
Copy code
val useCaseFunction = resolver.getFunctionDeclarationsByName("com.my.package.testFunction").toList()
if (useCaseFunction.isEmpty()) {
  environment.logger.warn("No functions found with name $useCaseFunctionName")
} else {
  environment.logger.warn("use case function: $useCaseFunction")
}
But I always get “No functions found with name com.jeantuffier.generator.getFact”. What am I suppose to use to make the resolver find the function?
j
fun getFunctionDeclarationsByName(name: KSName, includeTopLevel: Boolean = false)
, there is an additional argument you need to set to be able to find top level functions, which is the function in your case.