How can i get kotlin or Java method 's comment

31 views
Skip to first unread message

Qi Justin

unread,
Jun 23, 2021, 9:16:27 AM6/23/21
to lint-dev
like this code:  How can i get method 's comment  "//list ", "//TODO: list2"

class MyProcess {

fun test() {
// list
Process.killProcess(0)
}

// method doc 2
fun test2() {
// TODO: list2
System.exit(0)
}
}

Tor Norbye

unread,
Jul 14, 2021, 8:05:26 PM7/14/21
to lint-dev
While UAST does provide comment nodes up at the UFile level (see the UComment lookup method), for this you typically will need to dip into PSI (via method.sourcePsi and locate the PsiComment nodes.

-- Tor

Reply all
Reply to author
Forward
0 new messages