private static PsiElement getFirstElementOnTheLine(TextRange lineRange, PsiElement element) {
    if (lineRange.contains(element.getTextOffset())) {
      return element;
    }

    // otherwise check all children
    if (intersects(lineRange, element)) {
      for (PsiElement child : SyntaxTraverser.psiTraverser(element)) {
        if (lineRange.contains(child.getTextOffset())) {
          return child;
        }
      }
    }

    return null;
  }
private static PsiElement getFirstElementOnTheLine(TextRange lineRange, PsiElement element)