Skip to content

Commit ecf0a0b

Browse files
author
Vitaliy
authored
Merge pull request #96 from konarshankar07/frontend-model-completion--task-90
#90 :- Completion. Add PHP classes completion to the frontend_model attribute and tag
2 parents e46cf09 + 364ba65 commit ecf0a0b

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,19 @@ public XmlCompletionContributor() {
105105

106106
// <source_model>php class completion</source_model> in system.xml files.
107107
extend(CompletionType.BASIC, psiElement(XmlTokenType.XML_DATA_CHARACTERS)
108-
.inside(XmlPatterns.xmlTag().withName(ModuleSystemXml.SOURCE_MODEL_ELEMENT_NAME)
108+
.inside(XmlPatterns.xmlTag().withName(ModuleSystemXml.XML_TAG_SOURCE_MODEL)
109109
.withParent(XmlPatterns.xmlTag().withName(ModuleSystemXml.FIELD_ELEMENT_NAME))
110110
).inFile(xmlFile().withName(string().endsWith(ModuleSystemXml.FILE_NAME))),
111111
new PhpClassCompletionProvider()
112112
);
113113

114+
// <frontend_model>completion</frontend_model>
115+
extend(CompletionType.BASIC,
116+
psiElement(XmlTokenType.XML_DATA_CHARACTERS)
117+
.inside(XmlPatterns.xmlTag().withName(ModuleSystemXml.XML_TAG_FRONTEND_MODEL)),
118+
new PhpClassCompletionProvider()
119+
);
120+
114121
// <parameter source_model="completion">...</parameter> in widget.xml files.
115122
extend(CompletionType.BASIC, psiElement(XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN)
116123
.inside(XmlPatterns.xmlAttribute().withName(ModuleWidgetXml.ATTRIBUTE_SOURCE_MODEL_NAME)

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
public class ModuleSystemXml {
88
public static final String FILE_NAME = "system.xml";
99
public static final String FIELD_ELEMENT_NAME = "field";
10-
public static final String SOURCE_MODEL_ELEMENT_NAME = "source_model";
10+
public static final String XML_TAG_SOURCE_MODEL = "source_model";
11+
public static final String XML_TAG_FRONTEND_MODEL = "frontend_model";
1112
}

0 commit comments

Comments
 (0)