private static WatchingInsertionContext insertItemHonorBlockSelection(CompletionProcessEx indicator,
                                                                        LookupElement item,
                                                                        char completionChar,
                                                                        StatisticsUpdate update) {
    final Editor editor = indicator.getEditor();
    int caretOffset = indicator.getCaret().getOffset();
    OffsetMap offsetMap = indicator.getOffsetMap();

    Lookup lookup = indicator.getLookup();
    List<LookupElement> items = lookup != null ? lookup.getItems() : Collections.emptyList();

    final int idEndOffset = CompletionUtil.calcIdEndOffset(offsetMap, editor, caretOffset);
    final int idEndOffsetDelta = idEndOffset - caretOffset;

    WatchingInsertionContext context = doInsertItem(indicator.getHostOffsets(),
      item,
      completionChar,
      update,
      editor,
      indicator.getProject(),
      caretOffset,
      offsetMap,
      items,
      idEndOffset,
      idEndOffsetDelta);

    if (lookup != null) {
      update.addSparedChars(lookup, item, context);
    }

    if (context.shouldAddCompletionChar()) {
      WriteAction.run(() -> addCompletionChar(context, item));
    }
    checkPsiTextConsistency(indicator);

    return context;
  }
private static WatchingInsertionContext insertItemHonorBlockSelection(CompletionProcessEx indicator,
                                                                        LookupElement item,
                                                                        char completionChar,
                                                                        StatisticsUpdate update)