File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
src/main/java/fr/adrienbrault/idea/symfony2plugin Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 1212import org .jetbrains .yaml .psi .YAMLCompoundValue ;
1313import org .jetbrains .yaml .psi .YAMLKeyValue ;
1414
15+ import static fr .adrienbrault .idea .symfony2plugin .util .VersionUtil .productVersionGreaterThanOrEqual ;
16+
1517/**
1618 * @author Daniel Espendiller <daniel@espendiller.net>
1719 */
@@ -39,7 +41,7 @@ private static class MyPsiElementVisitor extends PsiElementVisitor {
3941 public void visitElement (PsiElement element ) {
4042 // every array element implements this interface
4143 // check for inside "foo: <foo: foo>"
42- if (!(element instanceof YAMLCompoundValue ) || element . getNode (). getElementType () != YAMLElementTypes . COMPOUND_VALUE ) {
44+ if (!isIllegalColonExpression (element ) ) {
4345 super .visitElement (element );
4446 return ;
4547 }
@@ -67,5 +69,14 @@ public void visitElement(PsiElement element) {
6769
6870 super .visitElement (element );
6971 }
72+
73+ private boolean isIllegalColonExpression (PsiElement element ) {
74+
75+ if (productVersionGreaterThanOrEqual (2018 , 3 )) {
76+ return (element instanceof YAMLCompoundValue ) && element .getNode ().getElementType () == YAMLElementTypes .MAPPING ;
77+ }
78+
79+ return (element instanceof YAMLCompoundValue ) && element .getNode ().getElementType () == YAMLElementTypes .COMPOUND_VALUE ;
80+ }
7081 }
7182}
Original file line number Diff line number Diff line change 1+ package fr .adrienbrault .idea .symfony2plugin .util ;
2+
3+ import com .intellij .openapi .application .ApplicationInfo ;
4+
5+ public class VersionUtil {
6+ public static boolean productVersionGreaterThanOrEqual (int major , int minor ) {
7+ ApplicationInfo instance = ApplicationInfo .getInstance ();
8+
9+ return Integer .valueOf (instance .getMajorVersion ()) > major || (Integer .valueOf (instance .getMajorVersion ()).equals (major ) && Integer .valueOf (instance .getMinorVersionMainPart ()) >= minor );
10+ }
11+ }
You can’t perform that action at this time.
0 commit comments