void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { PsiSnippetDocTag snippetTag = PsiTreeUtil.getParentOfType(element, PsiSnippetDocTag.class); if (snippetTag == null) return; PsiSnippetDocTagValue valueElement = snippetTag.getValueElement(); if (valueElement == null) return; PsiSnippetDocTagBody body = valueElement.getBody(); if (body == null) return; PsiDocComment comment = JavaPsiFacade.getElementFactory(project).createDocCommentFromText(StringUtil.join( "/**\n* {@snippet :\n" + StreamEx.split(myText, '\n', false) .map(line -> "* " + line).joining("\n") + "}*/" )); PsiSnippetDocTag newSnippet = PsiTreeUtil.getChildOfType(comment, PsiSnippetDocTag.class); if (newSnippet == null) return; PsiSnippetDocTagValue newValueElement = Objects.requireNonNull(newSnippet.getValueElement()); newValueElement.getAttributeList().replace(valueElement.getAttributeList()); snippetTag.replace(newSnippet); }