diff options
Diffstat (limited to 'src/Model/SourceLinks.kt')
-rw-r--r-- | src/Model/SourceLinks.kt | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/Model/SourceLinks.kt b/src/Model/SourceLinks.kt index 4530518f..956bfe4b 100644 --- a/src/Model/SourceLinks.kt +++ b/src/Model/SourceLinks.kt @@ -15,7 +15,7 @@ fun DocumentationNode.appendSourceLink(psi: PsiElement?, sourceLinks: List<Sourc val absPath = File(path).absolutePath val linkDef = sourceLinks.firstOrNull { absPath.startsWith(it.path) } if (linkDef != null) { - var url = linkDef.url + path.substring(linkDef.path.length()) + var url = linkDef.url + path.substring(linkDef.path.length) if (linkDef.lineSuffix != null) { val line = target?.lineNumber() if (line != null) { @@ -50,8 +50,7 @@ fun PsiElement.lineNumber(): Int? { } fun PsiElement.columnNumber(): Int? { - val doc = PsiDocumentManager.getInstance(project).getDocument(containingFile) - // IJ uses 0-based line-numbers; external source browsers use 1-based - val lineNumber = doc?.getLineNumber(textRange.startOffset)?.plus(1) ?: return null - return startOffset - doc!!.getLineStartOffset(lineNumber) + val doc = PsiDocumentManager.getInstance(project).getDocument(containingFile) ?: return null + val lineNumber = doc.getLineNumber(textRange.startOffset) + return startOffset - doc.getLineStartOffset(lineNumber) }
\ No newline at end of file |