void (@NotNull CompletionParameters parameters, @NotNull ProcessingContext context, @NotNull CompletionResultSet result) { if (!canProvideHtmlElementInTextCompletion(parameters)) return; // We cannot modify the file in injections - disable the feature if (parameters.getPosition().getContainingFile().isPhysical()) return; PsiFile completionFile = parameters.getPosition().getContainingFile(); int offset = parameters.getOffset(); var offsets = new OffsetsInFile(completionFile); offsets.getOffsets().addOffset(CompletionInitializationContext.START_OFFSET, offset); offsets = offsets.copyWithReplacement(offset, offset, "<"); PsiElement tag = doIfNotNull(offsets.getFile().findElementAt(offset + 1), PsiElement::getParent); if (tag instanceof XmlTag) { CompletionResultSet patchedResultSet = patchResultSetForHtmlElementInTextCompletion(result, parameters); for (LookupElement variant : TagNameReferenceCompletionProvider.getTagNameVariants((XmlTag)tag, "")) { LookupElement decorated = new LookupElementDecorator<>(variant) { @Override public @NotNull String getLookupString() { return "<" + super.getLookupString(); } @Override public void renderElement(@NotNull LookupElementPresentation presentation) { super.renderElement(presentation); presentation.setItemText("<" + presentation.getItemText()); } }; if (variant instanceof PrioritizedLookupElement) { decorated = PrioritizedLookupElement.withGrouping( PrioritizedLookupElement.withExplicitProximity( PrioritizedLookupElement.withPriority(decorated, ((PrioritizedLookupElement<?>)variant).getPriority()), ((PrioritizedLookupElement<?>)variant).getExplicitProximity()), ((PrioritizedLookupElement<?>)variant).getGrouping()); } patchedResultSet.consume(decorated); } patchedResultSet.runRemainingContributors(parameters, r -> { patchedResultSet.withPrefixMatcher(r.getPrefixMatcher()) .withRelevanceSorter(withoutLiveTemplatesWeigher(r.getSorter(), parameters, r.getPrefixMatcher())) .addElement(r.getLookupElement()); }); } if (result.getPrefixMatcher().getPrefix().length() < 2) { result.restartCompletionOnAnyPrefixChange(); } }