Skip to content

Commit 7e53e34

Browse files
Feedback changes
1 parent 932b328 commit 7e53e34

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

src/com/magento/idea/magento2plugin/completion/xml/XmlCompletionContributor.java

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
import com.intellij.psi.xml.XmlTokenType;
1111
import com.magento.idea.magento2plugin.completion.provider.*;
1212
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+
import com.magento.idea.magento2plugin.magento.files.*;
1614

1715
import static com.intellij.patterns.PlatformPatterns.psiElement;
1816
import static com.intellij.patterns.StandardPatterns.string;
@@ -45,21 +43,37 @@ public XmlCompletionContributor() {
4543
);
4644

4745
/* PHP Class completion provider */
46+
47+
// <randomTag xsi:type="completion">
4848
extend(CompletionType.BASIC, psiElement(XmlTokenType.XML_DATA_CHARACTERS)
4949
.withParent(XmlPatterns.xmlText().withParent(XmlPatterns.xmlTag().withChild(
5050
XmlPatterns.xmlAttribute().withName(CommonXml.SCHEMA_VALIDATE_ATTRIBUTE).withValue(string().oneOf(CommonXml.OBJECT))))
5151
),
5252
new PhpClassCompletionProvider()
5353
);
5454

55+
// <randomTag class="completion">
5556
extend(CompletionType.BASIC, psiElement(XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN)
5657
.inside(XmlPatterns.xmlAttribute().withName(CommonXml.ATTR_CLASS)),
5758
new PhpClassCompletionProvider()
5859
);
5960

61+
// <preference for="completion">
62+
extend(CompletionType.BASIC, psiElement(XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN)
63+
.inside(XmlPatterns.xmlAttribute().withName(ModuleDiXml.PREFERENCE_ATTR_FOR)),
64+
new PhpClassCompletionProvider()
65+
);
66+
67+
// <type name="completion">
68+
extend(CompletionType.BASIC, psiElement(XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN)
69+
.inside(XmlPatterns.xmlAttribute().withName(ModuleDiXml.PLUGIN_TYPE_ATTR_NAME)
70+
.withParent(XmlPatterns.xmlTag().withName(ModuleDiXml.PLUGIN_TYPE_TAG))),
71+
new PhpClassCompletionProvider()
72+
);
73+
6074
/* File Path Completion provider */
6175
extend(CompletionType.BASIC, psiElement(XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN)
62-
.inside(XmlPatterns.xmlAttribute().withName("template")),
76+
.inside(XmlPatterns.xmlAttribute().withName(LayoutXml.XML_ATTRIBUTE_TEMPLATE)),
6377
new FilePathCompletionProvider()
6478
);
6579

src/com/magento/idea/magento2plugin/magento/files/LayoutXml.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ public class LayoutXml {
1010
public static String CacheableAttributeFalseValue = "false";
1111
public static String BlockAttributeTagName = "block";
1212
public static String ReferenceBlockAttributeTagName = "referenceBlock";
13+
public static String XML_ATTRIBUTE_TEMPLATE = "template";
1314
}

0 commit comments

Comments
 (0)