blob: 68cdab4a25aebdc4305fd09d36c70e91e9b9840e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
package org.jetbrains.dokka
import com.intellij.psi.PsiDocumentManager
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiNameIdentifierOwner
import org.jetbrains.dokka.DokkaConfiguration.SourceLinkDefinition
import org.jetbrains.kotlin.psi.psiUtil.startOffset
import java.io.File
fun PsiElement.lineNumber(): Int? {
val doc = PsiDocumentManager.getInstance(project).getDocument(containingFile)
// IJ uses 0-based line-numbers; external source browsers use 1-based
return doc?.getLineNumber(textRange.startOffset)?.plus(1)
}
|