private static @Nullable String getTaskNameCandidate(PsiElement element) {
    if (!(element instanceof LeafElement leaf)
        || element instanceof PsiWhiteSpace
        || element instanceof PsiComment
    ) {
      return null;
    }

    if (parentIsReferenceInMethodCall(element)) {
      return element.getText().trim();
    }
    else if (isLiteralArgumentOfMethodCall(element)
             && (leaf.getElementType() == STRING_SQ || leaf.getElementType() == STRING_DQ)
    ) {
      return leaf.getText().substring(1, leaf.getText().length() - 1);
    }
    return null;
  }
private static @Nullable String getTaskNameCandidate(PsiElement element)