void (CompletionInitializationContextImpl initContext, CompletionProgressIndicator indicator, boolean hasModifiers) { CompletionPhase phase; if (synchronous) { phase = new CompletionPhase.BgCalculation(indicator); indicator.showLookup(); } else { phase = new CompletionPhase.CommittingDocuments(indicator, InjectedLanguageEditorUtil.getTopLevelEditor(indicator.getEditor())); } CompletionServiceImpl.setCompletionPhase(phase); ReadAction .nonBlocking(() -> CompletionInitializationUtil.insertDummyIdentifier(initContext, indicator)) .expireWith(phase) .withDocumentsCommitted(indicator.getProject()) .finishOnUiThread(ModalityState.defaultModalityState(), applyPsiChanges -> { OffsetsInFile hostCopyOffsets = applyPsiChanges.get(); if (phase instanceof CompletionPhase.CommittingDocuments) { ((CompletionPhase.CommittingDocuments)phase).replaced = true; } CompletionServiceImpl.setCompletionPhase(new CompletionPhase.BgCalculation(indicator)); startContributorThread(initContext, indicator, hostCopyOffsets, hasModifiers); }) .submit(AppExecutorUtil.getAppExecutorService()); }