void (CompletionInitializationContextImpl initContext, boolean hasModifiers, boolean isValidContext, long startingTime) { final Editor editor = initContext.getEditor(); CompletionAssertions.checkEditorValid(editor); LookupImpl lookup = obtainLookup(editor, initContext.getProject()); CompletionPhase phase = CompletionServiceImpl.getCompletionPhase(); if (phase instanceof CompletionPhase.CommittingDocuments) { if (phase.indicator != null) { phase.indicator.closeAndFinish(false); } ((CompletionPhase.CommittingDocuments)phase).replaced = true; } else { CompletionServiceImpl.assertPhase(CompletionPhase.NoCompletion.getClass()); } CompletionProgressIndicator indicator = new CompletionProgressIndicator(editor, initContext.getCaret(), initContext.getInvocationCount(), this, initContext.getOffsetMap(), initContext.getHostOffsets(), hasModifiers, lookup); if (synchronous && isValidContext) { OffsetsInFile hostCopyOffsets = withTimeout(calcSyncTimeOut(startingTime), () -> { PsiDocumentManager.getInstance(initContext.getProject()).commitAllDocuments(); return CompletionInitializationUtil.insertDummyIdentifier(initContext, indicator).get(); }); if (hostCopyOffsets != null) { trySynchronousCompletion(initContext, hasModifiers, startingTime, indicator, hostCopyOffsets); return; } } scheduleContributorsAfterAsyncCommit(initContext, indicator, hasModifiers); }