10
10
import com .intellij .psi .xml .XmlTokenType ;
11
11
import com .magento .idea .magento2plugin .completion .provider .*;
12
12
import com .magento .idea .magento2plugin .completion .provider .mftf .*;
13
+ import com .magento .idea .magento2plugin .magento .files .CommonXml ;
14
+ import com .magento .idea .magento2plugin .magento .files .ModuleAclXml ;
15
+ import com .magento .idea .magento2plugin .magento .files .ModuleXml ;
13
16
14
17
import static com .intellij .patterns .PlatformPatterns .psiElement ;
15
18
import static com .intellij .patterns .StandardPatterns .string ;
@@ -22,34 +25,35 @@ public XmlCompletionContributor() {
22
25
/* PHP class member completion provider */
23
26
extend (CompletionType .BASIC , psiElement (XmlTokenType .XML_DATA_CHARACTERS )
24
27
.withParent (XmlPatterns .xmlText ().withParent (XmlPatterns .xmlTag ().withChild (
25
- XmlPatterns .xmlAttribute ().withName ("xsi:type" ).withValue (string ().oneOf ("init_parameter" ))))
28
+ XmlPatterns .xmlAttribute ().withName (CommonXml .SCHEMA_VALIDATE_ATTRIBUTE )
29
+ .withValue (string ().oneOf (CommonXml .INIT_PARAMETER ))))
26
30
),
27
31
new PhpClassMemberCompletionProvider ()
28
32
);
29
33
30
34
/* Module Completion provider */
31
35
extend (CompletionType .BASIC , psiElement (XmlTokenType .XML_ATTRIBUTE_VALUE_TOKEN )
32
- .inside (XmlPatterns .xmlAttribute ().withName ("id" ))
33
- .inFile (xmlFile ().withName (string ().endsWith ("acl.xml" ))),
36
+ .inside (XmlPatterns .xmlAttribute ().withName (ModuleAclXml . XML_ATTR_ID ))
37
+ .inFile (xmlFile ().withName (string ().endsWith (ModuleAclXml . FILE_NAME ))),
34
38
new ModuleNameCompletionProvider ()
35
39
);
36
40
37
41
extend (CompletionType .BASIC , psiElement (XmlTokenType .XML_ATTRIBUTE_VALUE_TOKEN )
38
- .inside (XmlPatterns .xmlAttribute ().withName ("name" ))
39
- .inFile (xmlFile ().withName (string ().endsWith ("module.xml" ))),
42
+ .inside (XmlPatterns .xmlAttribute ().withName (ModuleXml . MODULE_ATTR_NAME ))
43
+ .inFile (xmlFile ().withName (string ().endsWith (ModuleXml . FILE_NAME ))),
40
44
new ModuleNameCompletionProvider ()
41
45
);
42
46
43
47
/* PHP Class completion provider */
44
48
extend (CompletionType .BASIC , psiElement (XmlTokenType .XML_DATA_CHARACTERS )
45
49
.withParent (XmlPatterns .xmlText ().withParent (XmlPatterns .xmlTag ().withChild (
46
- XmlPatterns .xmlAttribute ().withName ("xsi:type" ).withValue (string ().oneOf ("object" ))))
50
+ XmlPatterns .xmlAttribute ().withName (CommonXml . SCHEMA_VALIDATE_ATTRIBUTE ).withValue (string ().oneOf (CommonXml . OBJECT ))))
47
51
),
48
52
new PhpClassCompletionProvider ()
49
53
);
50
54
51
55
extend (CompletionType .BASIC , psiElement (XmlTokenType .XML_ATTRIBUTE_VALUE_TOKEN )
52
- .inside (XmlPatterns .xmlAttribute ().withName ("class" )),
56
+ .inside (XmlPatterns .xmlAttribute ().withName (CommonXml . ATTR_CLASS )),
53
57
new PhpClassCompletionProvider ()
54
58
);
55
59
0 commit comments