void duringCompletion(CompletionInitializationContext initContext) { if (isAutopopupCompletion()) { if (shouldFocusLookup(myParameters)) { myLookup.setFocused(true); } else if (FeatureUsageTracker.getInstance() .isToBeAdvertisedInLookup( CodeCompletionFeatures.EDITING_COMPLETION_CONTROL_ENTER, getProject())) { myLookup.addAdvertisement( "Press " + CompletionContributor.getActionShortcut( IdeActions.ACTION_CHOOSE_LOOKUP_ITEM_ALWAYS) + " to choose the first suggestion"); } if (!myEditor.isOneLineMode() && FeatureUsageTracker.getInstance() .isToBeAdvertisedInLookup( CodeCompletionFeatures.EDITING_COMPLETION_CONTROL_ARROWS, getProject())) { myLookup.addAdvertisement( CompletionContributor.getActionShortcut(IdeActions.ACTION_LOOKUP_DOWN) + " and " + CompletionContributor.getActionShortcut(IdeActions.ACTION_LOOKUP_UP) + " will move caret down and up in the editor"); } } ProgressManager.checkCanceled(); if (!initContext .getOffsetMap() .wasModified(CompletionInitializationContext.IDENTIFIER_END_OFFSET)) { try { final int selectionEndOffset = initContext.getSelectionEndOffset(); final PsiReference reference = initContext.getFile().findReferenceAt(selectionEndOffset); if (reference != null) { initContext.setReplacementOffset(findReplacementOffset(selectionEndOffset, reference)); } } catch (IndexNotReadyException ignored) { } } for (CompletionContributor contributor : CompletionContributor.forLanguage(initContext.getPositionLanguage())) { ProgressManager.checkCanceled(); if (DumbService.getInstance(initContext.getProject()).isDumb() && !DumbService.isDumbAware(contributor)) { continue; } contributor.duringCompletion(initContext); } }