mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-07 22:09:38 +07:00
SSR: remove extra semicolon (IDEA-227210)
GitOrigin-RevId: 33a0b298fe7796738cb092a5bce0e934debab5cd
This commit is contained in:
committed by
intellij-monorepo-bot
parent
1c43cee370
commit
80b440df83
@@ -961,27 +961,26 @@ public class JavaStructuralSearchProfile extends StructuralSearchProfile {
|
||||
}
|
||||
|
||||
private static int removeExtraSemicolon(ParameterInfo info, int offset, StringBuilder result, MatchResult match) {
|
||||
if (info.isStatementContext()) {
|
||||
final int index = offset + info.getStartIndex();
|
||||
final PsiElement matchElement = (match == null) ? null : match.getMatch();
|
||||
if (result.charAt(index) == ';' &&
|
||||
( matchElement == null ||
|
||||
( result.charAt(index-1)=='}' &&
|
||||
!(matchElement instanceof PsiDeclarationStatement) && // array init in dcl
|
||||
!(matchElement instanceof PsiNewExpression) && // array initializer
|
||||
!(matchElement instanceof PsiArrayInitializerExpression)
|
||||
) ||
|
||||
( match.isMultipleMatch() // ; in comment
|
||||
? match.getChildren().get(match.getChildren().size() - 1).getMatch() instanceof PsiComment
|
||||
: matchElement instanceof PsiComment
|
||||
)
|
||||
)
|
||||
) {
|
||||
result.deleteCharAt(index);
|
||||
--offset;
|
||||
}
|
||||
if (!info.isStatementContext()) {
|
||||
return offset;
|
||||
}
|
||||
final int index = offset + info.getStartIndex();
|
||||
if (result.charAt(index) != ';') {
|
||||
return offset;
|
||||
}
|
||||
final PsiElement matchElement;
|
||||
if (match == null) matchElement = null;
|
||||
else if (match.isMultipleMatch()) matchElement = match.getChildren().get(match.size() - 1).getMatch();
|
||||
else matchElement = match.getMatch();
|
||||
|
||||
if (matchElement == null || matchElement instanceof PsiComment ||
|
||||
result.charAt(index - 1) == '}' &&
|
||||
!(matchElement instanceof PsiDeclarationStatement) && // array init in dcl
|
||||
!(matchElement instanceof PsiNewExpression) && // array initializer
|
||||
!(matchElement instanceof PsiArrayInitializerExpression)) {
|
||||
result.deleteCharAt(index);
|
||||
--offset;
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user