Adapt exception line numbering for file link (KT-38079)

#KT-38079 Fixed
This commit is contained in:
Kirill Shmakov
2020-04-07 17:58:29 +03:00
parent 7448761dfd
commit 2b8b5af18b
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -153,7 +153,8 @@ class KotlinExceptionFilter(private val searchScope: GlobalSearchScope) : Filter
val offset = entireLength - rawLine.length + rawLine.indexOf(atPrefix) val offset = entireLength - rawLine.length + rawLine.indexOf(atPrefix)
val highlightEndOffset = offset + (if (lineNumber > 0) line.lastIndex else fileNameEnd) val highlightEndOffset = offset + (if (lineNumber > 0) line.lastIndex else fileNameEnd)
val hyperLinkInfo = OpenFileHyperlinkInfo(project, virtualFile, lineNumber, columnNumber) // OpenFileHyperlinkInfo accepts zero-based line number
val hyperLinkInfo = OpenFileHyperlinkInfo(project, virtualFile, lineNumber - 1, columnNumber)
return Filter.Result(offset + fileNameBegin, highlightEndOffset, hyperLinkInfo) return Filter.Result(offset + fileNameBegin, highlightEndOffset, hyperLinkInfo)
} }