String (@NotNull PsiElement position, @NotNull String prefix) { final PsiElement prevLeaf = PsiTreeUtil.prevLeaf(position); final PsiElement prevPrevLeaf = prevLeaf != null ? PsiTreeUtil.prevLeaf(prevLeaf):null; if (prevLeaf != null) { final String prevLeafText = prevLeaf.getText(); if("#".equals(prevLeafText)) { prefix = "#" + prefix; } else if ("!".equals(prevLeafText) && prevPrevLeaf != null && "<".equals(prevPrevLeaf.getText())) { prefix = "<!" + prefix; } } return prefix; }