void (@NotNull PsiElement comment, @NotNull String id, boolean replaceOtherSuppressionIds, @NotNull Language commentLanguage) { final String oldSuppressionCommentText = comment.getText(); final String lineCommentPrefix = getLineCommentPrefix(comment); if (!replaceOtherSuppressionIds && oldSuppressionCommentText.contains(id) && StringUtil.getWordsIn(oldSuppressionCommentText).contains(id)) { return; } Couple<String> blockPrefixSuffix = null; if (lineCommentPrefix == null) { blockPrefixSuffix = getBlockPrefixSuffixPair(comment); } assert blockPrefixSuffix != null && oldSuppressionCommentText.startsWith(blockPrefixSuffix.first) && oldSuppressionCommentText.endsWith(blockPrefixSuffix.second) || lineCommentPrefix != null && oldSuppressionCommentText.startsWith(lineCommentPrefix) : "Unexpected suppression comment " + oldSuppressionCommentText; // append new suppression tool id or replace final String newText; if(replaceOtherSuppressionIds) { newText = SUPPRESS_INSPECTIONS_TAG_NAME + " " + id; } else if (lineCommentPrefix == null) { newText = oldSuppressionCommentText.substring(blockPrefixSuffix.first.length(), oldSuppressionCommentText.length() - blockPrefixSuffix.second.length()) + "," + id; } else { newText = oldSuppressionCommentText.substring(lineCommentPrefix.length()) + "," + id; } comment.replace(createComment(comment.getProject(), newText, commentLanguage)); }