private static @NotNull String getUsageLineSnippet(@NotNull Project project, @NotNull PsiElement element) {
    Ref<String> usageLineSnippet = new Ref<>("");
    ApplicationManager.getApplication().runReadAction(() -> {
      PsiDocumentManager docManager = PsiDocumentManager.getInstance(project);
      Document doc = docManager.getDocument(element.getContainingFile());
      if (doc != null) {
        int usageStartLineNumber = doc.getLineNumber(element.getTextRange().getStartOffset());
        int usageEndLineNumber = doc.getLineNumber(element.getTextRange().getEndOffset());
        usageLineSnippet.set(doc.getText(new TextRange(doc.getLineStartOffset(usageStartLineNumber),
                                                       doc.getLineEndOffset(Math.min(usageEndLineNumber, doc.getLineCount() - 1)))));
      }
    });
    return StringUtil.escapeChars(removeNewLines(usageLineSnippet.get()), '\\', '"').trim();
  }
private static @NotNull String getUsageLineSnippet(@NotNull Project project, @NotNull PsiElement element)