[properties] IDEA-248873 - Cannot programmatically add comments to properties file
authorNikita Eshkeev <nikita.eshkeev@jetbrains.com>
Wed, 21 Oct 2020 08:24:38 +0000 (11:24 +0300)
committerintellij-monorepo-bot <intellij-monorepo-bot-no-reply@jetbrains.com>
Wed, 21 Oct 2020 08:33:55 +0000 (08:33 +0000)
This patch changes the check if the left node is a comment with simple equality

Signed-off-by: Nikita Eshkeev <nikita.eshkeev@jetbrains.com>
GitOrigin-RevId: 79d6250e1facfc0c25ad277b49f45d9dde7f027f

plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/parsing/PropertiesParserDefinition.java

index 4fbb948a241d772c9821e21ff053c38daa163071..2abdef3448d7b298690638aaf9426dfd5b352f09 100644 (file)
@@ -60,7 +60,9 @@ public class PropertiesParserDefinition implements ParserDefinition {
 
   @Override
   public SpaceRequirements spaceExistenceTypeBetweenTokens(ASTNode left, ASTNode right) {
-    if (PropertiesTokenTypes.COMMENTS.contains(left.getElementType())) return SpaceRequirements.MUST_LINE_BREAK;
+    if (left.getElementType() == PropertiesTokenTypes.END_OF_LINE_COMMENT) {
+      return SpaceRequirements.MUST_LINE_BREAK;
+    }
     return SpaceRequirements.MAY;
   }