Skip to content

Commit cbc75b2

Browse files
author
Vitaliy
authored
Merge pull request #108 from konarshankar07/backend-model-completion--task-89
#89 : Completion. Add PHP classes completion to the backend_model attribute and tag
2 parents 14df6aa + 44ec62e commit cbc75b2

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,19 @@ public XmlCompletionContributor() {
118118
new PhpClassCompletionProvider()
119119
);
120120

121+
// <backend_model>completion</backend_model>
122+
extend(CompletionType.BASIC,
123+
psiElement(XmlTokenType.XML_DATA_CHARACTERS)
124+
.inside(XmlPatterns.xmlTag().withName(ModuleSystemXml.XML_TAG_BACKEND_MODEL)),
125+
new PhpClassCompletionProvider()
126+
);
127+
128+
// <randomTag backend_model="completion">
129+
extend(CompletionType.BASIC, psiElement(XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN)
130+
.inside(XmlPatterns.xmlAttribute().withName(ModuleConfigXml.XML_ATTRIBUTE_BACKEND_MODEL)),
131+
new PhpClassCompletionProvider()
132+
);
133+
121134
// <parameter source_model="completion">...</parameter> in widget.xml files.
122135
extend(CompletionType.BASIC, psiElement(XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN)
123136
.inside(XmlPatterns.xmlAttribute().withName(ModuleWidgetXml.ATTRIBUTE_SOURCE_MODEL_NAME)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
package com.magento.idea.magento2plugin.magento.files;
6+
7+
public class ModuleConfigXml {
8+
public static final String XML_ATTRIBUTE_BACKEND_MODEL = "backend_model";
9+
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ public class ModuleSystemXml {
99
public static final String FIELD_ELEMENT_NAME = "field";
1010
public static final String XML_TAG_SOURCE_MODEL = "source_model";
1111
public static final String XML_TAG_FRONTEND_MODEL = "frontend_model";
12+
public static final String XML_TAG_BACKEND_MODEL = "backend_model";
1213
}

0 commit comments

Comments
 (0)