fun resolvePosition()

in src/main/kotlin/consumer/ScipService.kt [74:87]


  fun resolvePosition(indexDoc: Scip.Document, scipRange: List<Int>?): Pair<VirtualFile, TextRange>? {
    val vFile = baseDir?.findFileByRelativePath(indexDoc.relativePath) ?: return null
    var startOffset = 0
    var endOffset = 0
    if (scipRange != null) {
      val doc = FileDocumentManager.getInstance().getDocument(vFile)
      if (doc != null) {
        startOffset = doc.getLineStartOffset(scipRange[0]) + scipRange[1]
        val endLine = if (scipRange.size == 3) scipRange[0] else scipRange[2]
        endOffset = doc.getLineEndOffset(endLine) + scipRange.last()
      }
    }
    return vFile to TextRange(startOffset, endOffset)
  }