void (@NotNull ParameterInfo info, @NotNull MatchResult match, @NotNull StringBuilder result, @NotNull ReplacementInfo replacementInfo) { if (info.getName().equals(match.getName())) { final String replacementString; boolean removeSemicolon = false; if (match.hasChildren() && !match.isScopeMatch()) { // compound matches final StringBuilder buf = new StringBuilder(); for (final MatchResult matchResult : match.getChildren()) { final PsiElement currentElement = matchResult.getMatch(); if (buf.length() > 0) { if (info.isArgumentContext()) { buf.append(','); } else { final PsiElement sibling = currentElement.getPrevSibling(); buf.append(sibling instanceof PsiWhiteSpace ? sibling.getText() : " "); } } buf.append(matchResult.getMatchImage()); removeSemicolon = currentElement instanceof PsiComment; } replacementString = buf.toString(); } else { if (info.isStatementContext()) { removeSemicolon = match.getMatch() instanceof PsiComment; } replacementString = match.getMatchImage(); } int offset = Replacer.insertSubstitution(result, 0, info, replacementString); if (info.isStatementContext() && (removeSemicolon || StringUtil.endsWithChar(replacementString, ';') || StringUtil.endsWithChar(replacementString, '}'))) { final int start = info.getStartIndex() + offset; result.delete(start, start + 1); } }