Hi friends. I am working with Kotlin embedded comp...
# compiler
b
Hi friends. I am working with Kotlin embedded compiler and I have a
org.jetbrains.kotlin.psi.KtNamedFunction
. Anyone know how I can get the line number in which the function resides. I can get the location with
startOffsetSkippingComments
and I assume I could calculate it myself by reading the file, but I was wondering, if there might be a different way.
a
I was using
PsiDiagnosticUtils.getLineAndColumnInPsiFile
for getting line numbers:
Copy code
internal fun PsiElement.lineAndColumn(): PsiDiagnosticUtils.LineAndColumn {
    return DiagnosticUtils.getLineAndColumnInPsiFile(containingFile, textRange) // wrap this in try catch