@Override
  public void handleInsert(@NotNull InsertionContext context) {
    Project project = context.getProject();
    int startOffset = context.getStartOffset();

    Editor editor = context.getEditor();
    PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument());
    PsiFile psiFile = context.getFile();
    PsiElement element = psiFile.findElementAt(startOffset);
    element = PsiTreeUtil.getParentOfType(element, PsiCatchSection.class, false);
    if (element != null) {
      JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance(project);
      PsiElement finalElement = element;
      element = DumbService.getInstance(project)
        .computeWithAlternativeResolveEnabled(() -> codeStyleManager.shortenClassReferences(finalElement));
    }
    PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument());

    if (element instanceof PsiCatchSection catchSection) {
      catchSection = (PsiCatchSection)CodeStyleManager.getInstance(project).reformat(catchSection);
      PsiCodeBlock catchBlock = catchSection.getCatchBlock();
      if (catchBlock != null) {
        TextRange rangeToSelect = SurroundWithUtil.getRangeToSelect(catchBlock);
        context.getEditor().getSelectionModel().setSelection(rangeToSelect.getStartOffset(), rangeToSelect.getEndOffset());
        editor.getCaretModel().moveToOffset(rangeToSelect.getEndOffset());
      }
    }
  }
@Override
  public void handleInsert(@NotNull InsertionContext context)