// Temporary // Returns comma if it's an enum entry without following comma (entry is not last in enum), // or semicolon if it's an enum entry without following semicolon, may be after comma (entry is // last in enum), // or empty string if an enum entry has the necessary following delimiter @NotNull private static String enumEntryExpectedDelimiter(@NotNull JetEnumEntry enumEntry) { PsiElement next = enumEntry.getNextSibling(); while (next != null) { if (next instanceof JetDeclaration) break; next = next.getNextSibling(); } JetDeclaration nextDeclaration = (JetDeclaration) next; next = PsiUtilPackage.getNextSiblingIgnoringWhitespaceAndComments(enumEntry); IElementType nextType = next != null ? next.getNode().getElementType() : null; if (nextDeclaration instanceof JetEnumEntry) { // Not last return nextType != JetTokens.COMMA ? "," : ""; } else { // Last: after it we can have semicolon, just closing brace, or comma followed by semicolon / // closing brace if (nextType == JetTokens.COMMA) { next = PsiUtilPackage.getNextSiblingIgnoringWhitespaceAndComments(next); nextType = next != null ? next.getNode().getElementType() : null; } return nextType != JetTokens.SEMICOLON && nextType != JetTokens.RBRACE ? ";" : ""; } }