WatchingInsertionContext (List<LookupElement> itemsAround, LookupElement item, char completionChar, OffsetMap offsetMap, OffsetsInFile hostOffset, Editor editor, Integer caretOffset, StatisticsUpdate update) { final int idEndOffset = CompletionUtil.calcIdEndOffset(offsetMap, editor, caretOffset); final int idEndOffsetDelta = idEndOffset - caretOffset; WatchingInsertionContext context = doInsertItem(hostOffset, item, completionChar, update, editor, Objects.requireNonNull(editor.getProject()), caretOffset, offsetMap, itemsAround, idEndOffset, idEndOffsetDelta); if (context.shouldAddCompletionChar()) { WriteAction.run(() -> addCompletionChar(context, item)); } return context; }