void (@NotNull ProblemsHolder holder, PsiElement element, PsiInlineDocTag tag) { if (element instanceof PsiSnippetDocTag snippet) { PsiElement nameElement = tag.getNameElement(); if (!PsiUtil.getLanguageLevel(snippet).isAtLeast(LanguageLevel.JDK_18)) { if (nameElement != null) { String message = JavaBundle.message("inspection.javadoc.problem.snippet.tag.is.not.available"); holder.registerProblem(nameElement, message, new IncreaseLanguageLevelFix(LanguageLevel.JDK_18)); } return; } PsiSnippetDocTagValue valueElement = snippet.getValueElement(); if (valueElement != null && nameElement != null) { PsiSnippetDocTagBody body = valueElement.getBody(); if (body != null) { SnippetMarkup markup = SnippetMarkup.fromElement(body); markup.visitSnippet(null, new SnippetMarkup.SnippetVisitor() { @Override public void visitError(SnippetMarkup.@NotNull ErrorMarkup errorMarkup) { holder.registerProblem(body, errorMarkup.range(), errorMarkup.message()); } }); SnippetMarkup externalMarkup = SnippetMarkup.fromExternalSnippet(valueElement); if (externalMarkup != null) { PsiSnippetAttribute regionAttr = valueElement.getAttributeList().getAttribute("region"); String region = regionAttr != null && regionAttr.getValue() != null ? regionAttr.getValue().getValue() : null; String externalRendered = renderText(externalMarkup, region); String inlineRegion = region != null && markup.getRegionStart(region) == null ? null : region; String inlineRendered = renderText(markup, inlineRegion); if (!externalRendered.equals(inlineRendered)) { holder.problem(nameElement, JavaBundle.message("inspection.message.external.snippet.differs.from.inline.snippet")) .fix(new SynchronizeInlineMarkupFix(externalRendered)) .fix(new DeleteElementFix(body)) .register(); } } } } } }