void (@NotNull Editor hostEditor, @NotNull PsiFile hostFile, @NotNull IntentionsInfo intentions, int passIdToShowIntentionsFor, boolean queryIntentionActions) { int offset = hostEditor.getCaretModel().getOffset(); PsiElement psiElement = hostFile.findElementAt(offset); if (psiElement != null) PsiUtilCore.ensureValid(psiElement); intentions.setOffset(offset); List<HighlightInfo.IntentionActionDescriptor> fixes = new ArrayList<>(); DaemonCodeAnalyzerImpl.HighlightByOffsetProcessor highestPriorityInfoFinder = new DaemonCodeAnalyzerImpl.HighlightByOffsetProcessor(true); List<HighlightInfo> infos = new ArrayList<>(); List<HighlightInfo> additionalInfos = new ArrayList<>(); Document document = hostEditor.getDocument(); int line = document.getLineNumber(offset); DaemonCodeAnalyzerEx.processHighlights(document, hostFile.getProject(), HighlightSeverity.INFORMATION, 0, document.getTextLength(), info -> { if (info.containsOffset(offset, true)) { infos.add(info); } else if (info.getSeverity().equals(HighlightSeverity.ERROR) && info.startOffset <= document.getTextLength() && document.getLineNumber(info.startOffset) == line) { additionalInfos.add(info); } return true; }); for (HighlightInfo info : infos) { addAvailableFixesForGroups(info, hostEditor, hostFile, fixes, passIdToShowIntentionsFor, offset, true); highestPriorityInfoFinder.process(info); } if (!ContainerUtil.exists(infos, info -> info.getSeverity().equals(HighlightSeverity.ERROR))) { for (HighlightInfo info : additionalInfos) { List<HighlightInfo.IntentionActionDescriptor> additionalFixes = new ArrayList<>(); addAvailableFixesForGroups(info, hostEditor, hostFile, additionalFixes, passIdToShowIntentionsFor, offset, false); boolean added = false; for (HighlightInfo.IntentionActionDescriptor fix : additionalFixes) { if (!ContainerUtil.exists(fixes, descriptor -> descriptor.getAction().getText().equals(fix.getAction().getText()))) { fix.setProblemOffset(info.startOffset); fixes.add(fix); added = true; } } if (added) { highestPriorityInfoFinder.process(info); break; } } } HighlightInfo infoAtCursor = highestPriorityInfoFinder.getResult(); intentions.setHighlightInfoType(infoAtCursor != null ? infoAtCursor.type : null); if (infoAtCursor == null) { intentions.errorFixesToShow.addAll(fixes); } else { fillIntentionsInfoForHighlightInfo(infoAtCursor, intentions, fixes); } ProgressIndicator indicator = ProgressIndicatorProvider.getGlobalProgressIndicator(); if (queryIntentionActions) { PsiFile injectedFile = InjectedLanguageUtilBase.findInjectedPsiNoCommit(hostFile, offset); Collection<String> languages = getLanguagesForIntentions(hostFile, psiElement, injectedFile); List<IntentionAction> availableIntentions = IntentionManager.getInstance().getAvailableIntentions(languages); for (IntentionAction action : availableIntentions) { if (indicator != null) { indicator.setText(action.getFamilyName()); } Pair<PsiFile, Editor> place = ShowIntentionActionsHandler.chooseBetweenHostAndInjected(hostFile, hostEditor, offset, injectedFile, (psiFile, editor, o) -> ShowIntentionActionsHandler.availableFor(psiFile, editor, o, action)); if (place != null) { List<IntentionAction> enableDisableIntentionAction = new ArrayList<>(); enableDisableIntentionAction.add(new EnableDisableIntentionAction(action)); enableDisableIntentionAction.add(new EditIntentionSettingsAction(action)); if (IntentionShortcutManager.getInstance().hasShortcut(action)) { enableDisableIntentionAction.add(new EditShortcutToIntentionAction(action)); enableDisableIntentionAction.add(new RemoveIntentionActionShortcut(action)); } else { enableDisableIntentionAction.add(new AssignShortcutToIntentionAction(action)); } HighlightInfo.IntentionActionDescriptor descriptor = new HighlightInfo.IntentionActionDescriptor(action, enableDisableIntentionAction, null, null, null, null, null); if (!fixes.contains(descriptor)) { intentions.intentionsToShow.add(descriptor); } } } if (indicator != null) { indicator.setText(CodeInsightBundle.message("progress.text.searching.for.additional.intention.actions.quick.fixes")); } for (IntentionMenuContributor extension : IntentionMenuContributor.EP_NAME.getExtensionList()) { try { extension.collectActions(hostEditor, hostFile, intentions, passIdToShowIntentionsFor, offset); } catch (IntentionPreviewUnsupportedOperationException e) { //can collect action on a mock memory editor and produce exceptions - ignore } } } }