Are there recommendations for working with Composable functions in lint?
Right now I’m trying to register a custom lint issue on a call to a Composable, but since the method names can be re-written (e.g.
Button
to
Button-bpaW8jA
) it is a little tricker to find the right Composables
😬 1
Bryan Herbst
10/29/2020, 7:48 PM
Sample of my
UElementHandler
I’m using to get the method and package names:
Copy code
override fun visitCallExpression(node: UCallExpression) {
val method = node.resolve()
val methodPackage = (method?.containingFile as? PsiJavaFile)?.packageName ?: return
// method.name resolves to "Button-bpaW8jA"
// methodPackage correctly resolves to "androidx.compose.material"
}
Bryan Herbst
10/29/2020, 7:49 PM
Of course I could just split the method name on the