Skip to content

Commit 469cb87

Browse files
author
Vitaliy
authored
Merge branch '1.0.1-develop' into issue-200-cover-observer-events.xml-generator
2 parents 0280847 + 016a60a commit 469cb87

File tree

37 files changed

+490
-97
lines changed

37 files changed

+490
-97
lines changed

.github/workflows/gradlepublishalpha.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ name: Publish Plugin alpha version
55
on:
66
push:
77
branches:
8-
- 1.0.1-develop
8+
- master
99

1010
jobs:
1111
build:
@@ -23,7 +23,6 @@ jobs:
2323
- name: Grant execute permission for gradlew
2424
run: chmod +x gradlew
2525
- name: Run publish plugin
26-
if: contains(github.event.pull_request.labels.*.name, 'deploy-alpha')
2726
run: ./gradlew publishPlugin -i
2827
env:
2928
MAGENTO_PHPSTORM_intellijPublishToken: ${{ secrets.JET_BRAINS_TOKEN }}

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

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,16 @@ public XmlCompletionContributor() {
7676
new FilePathCompletionProvider()
7777
);
7878

79+
extend(CompletionType.BASIC, psiElement(XmlTokenType.XML_DATA_CHARACTERS)
80+
.withParent(XmlPatterns.xmlText().withParent(
81+
XmlPatterns.xmlTag().withName(UiComponentXml.XML_TAG_ITEM).withChild(
82+
XmlPatterns.xmlAttribute().withValue(string()
83+
.matches(UiComponentXml.XML_ATTRIBUTE_TEMPLATE))
84+
))
85+
),
86+
new FilePathCompletionProvider()
87+
);
88+
7989
extend(CompletionType.BASIC, psiElement(XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN)
8090
.inside(XmlPatterns.xmlAttribute().withName("type")),
8191
new VirtualTypeCompletionProvider()
@@ -198,21 +208,28 @@ public XmlCompletionContributor() {
198208

199209
extend(CompletionType.BASIC, psiElement(XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN)
200210
.inside(XmlPatterns.xmlAttributeValue().withParent(
201-
XmlPatterns.xmlAttribute().withName("component")
211+
XmlPatterns.xmlAttribute().withName(UiComponentXml.XML_ATTRIBUTE_COMPONENT)
202212
)),
203-
new RequireJsMappingCompletionProvider()
213+
new CompositeCompletionProvider(
214+
new RequireJsMappingCompletionProvider(),
215+
new FilePathCompletionProvider()
216+
)
204217
);
205218

206219
extend(CompletionType.BASIC, psiElement(XmlTokenType.XML_DATA_CHARACTERS)
207220
.withParent(XmlPatterns.xmlText().withParent(
208-
XmlPatterns.xmlTag().withName("item").withChild(
209-
XmlPatterns.xmlAttribute().withValue(string().matches("component"))
221+
XmlPatterns.xmlTag().withName(UiComponentXml.XML_TAG_ITEM).withChild(
222+
XmlPatterns.xmlAttribute().withValue(string()
223+
.matches(UiComponentXml.XML_ATTRIBUTE_COMPONENT))
210224
).withChild(
211-
XmlPatterns.xmlAttribute().withName("name")
225+
XmlPatterns.xmlAttribute().withName(UiComponentXml.XML_ATTRIBUTE_NAME)
212226
)
213227
)
214228
),
215-
new RequireJsMappingCompletionProvider()
229+
new CompositeCompletionProvider(
230+
new RequireJsMappingCompletionProvider(),
231+
new FilePathCompletionProvider()
232+
)
216233
);
217234

218235
// mftf action group completion contributor
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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 UiComponentXml {
8+
public static String XML_ATTRIBUTE_TEMPLATE = "template";
9+
public static String XML_ATTRIBUTE_COMPONENT = "component";
10+
public static String XML_TAG_ITEM = "item";
11+
public static String XML_ATTRIBUTE_NAME = "name";
12+
}

src/com/magento/idea/magento2plugin/magento/packages/Package.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
public class Package {
88
public static String PACKAGES_ROOT = "app/code";
9+
public static String LIB_WEB_ROOT = "lib/web";
910
public static String APP = "app";
1011
public static String VENDOR = "vendor";
1112
public static String MODULE_BASE_AREA_DIR = "etc";

src/com/magento/idea/magento2plugin/reference/xml/XmlReferenceContributor.java

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import com.intellij.psi.xml.XmlTokenType;
1111
import com.magento.idea.magento2plugin.magento.files.MftfActionGroup;
1212
import com.magento.idea.magento2plugin.magento.files.MftfTest;
13+
import com.magento.idea.magento2plugin.magento.files.UiComponentXml;
1314
import com.magento.idea.magento2plugin.reference.provider.*;
1415
import com.magento.idea.magento2plugin.reference.provider.mftf.*;
1516
import com.magento.idea.magento2plugin.util.RegExUtil;
@@ -226,24 +227,38 @@ public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar)
226227

227228
// <someXmlTag component="requireJsMappingKey" />
228229
registrar.registerReferenceProvider(
229-
XmlPatterns.xmlAttributeValue().withParent(
230-
XmlPatterns.xmlAttribute().withName("component")
231-
),
232-
new RequireJsPreferenceReferenceProvider()
230+
XmlPatterns.xmlAttributeValue().withParent(
231+
XmlPatterns.xmlAttribute().withName(UiComponentXml.XML_ATTRIBUTE_COMPONENT)
232+
),
233+
new RequireJsPreferenceReferenceProvider()
233234
);
234235

235236
// <item name="component">requireJsMappingKey</item>
236237
registrar.registerReferenceProvider(
237-
XmlPatterns.psiElement(XmlTokenType.XML_DATA_CHARACTERS).withParent(
238-
XmlPatterns.xmlText().withParent(
239-
XmlPatterns.xmlTag().withName("item").withChild(
240-
XmlPatterns.xmlAttribute().withValue(string().matches("component"))
241-
).withChild(
242-
XmlPatterns.xmlAttribute().withName("name")
243-
)
244-
)
245-
),
246-
new RequireJsPreferenceReferenceProvider()
238+
XmlPatterns.psiElement(XmlTokenType.XML_DATA_CHARACTERS).withParent(
239+
XmlPatterns.xmlText().withParent(
240+
XmlPatterns.xmlTag().withName(UiComponentXml.XML_TAG_ITEM).withChild(
241+
XmlPatterns.xmlAttribute().withValue(string().matches(UiComponentXml.XML_ATTRIBUTE_COMPONENT))
242+
).withChild(
243+
XmlPatterns.xmlAttribute().withName(UiComponentXml.XML_ATTRIBUTE_NAME)
244+
)
245+
)
246+
),
247+
new RequireJsPreferenceReferenceProvider()
248+
);
249+
250+
// <item name="template">reference</item>
251+
registrar.registerReferenceProvider(
252+
XmlPatterns.psiElement(XmlTokenType.XML_DATA_CHARACTERS).withParent(
253+
XmlPatterns.xmlText().withParent(
254+
XmlPatterns.xmlTag().withName(UiComponentXml.XML_TAG_ITEM).withChild(
255+
XmlPatterns.xmlAttribute().withValue(string().matches(UiComponentXml.XML_ATTRIBUTE_TEMPLATE))
256+
).withChild(
257+
XmlPatterns.xmlAttribute().withName(UiComponentXml.XML_ATTRIBUTE_NAME)
258+
)
259+
)
260+
),
261+
new FilePathReferenceProvider()
247262
);
248263

249264
registerReferenceForDifferentNesting(registrar);

src/com/magento/idea/magento2plugin/stubs/indexes/js/MagentoLibJsIndex.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
import com.intellij.util.indexing.*;
1010
import com.intellij.util.io.EnumeratorStringDescriptor;
1111
import com.intellij.util.io.KeyDescriptor;
12+
import com.magento.idea.magento2plugin.magento.packages.File;
13+
import com.magento.idea.magento2plugin.magento.packages.Package;
14+
import com.magento.idea.magento2plugin.project.Settings;
1215
import org.jetbrains.annotations.NotNull;
1316

1417
import java.util.HashMap;
@@ -29,7 +32,8 @@ public ID<String, Void> getName() {
2932
public DataIndexer<String, Void, FileContent> getIndexer() {
3033
return inputData -> {
3134
Map<String, Void> map = new HashMap<>();
32-
String libPath = inputData.getProject().getBasePath() + "/lib/web/";
35+
String libPath = Settings.getMagentoPath(inputData.getProject()) +
36+
File.separator + Package.LIB_WEB_ROOT + File.separator;
3337
VirtualFile file = inputData.getFile();
3438

3539
if (!file.getPath().contains(libPath)){
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
4+
<fieldset name="general" >
5+
<field name="test_field" component="Foo_Bar/js/fi<caret>">
6+
</field>
7+
</fieldset>
8+
</form>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
4+
<dataSource name="test_source">
5+
<argument name="data" xsi:type="array">
6+
<item name="js_config" xsi:type="array">
7+
<item name="component" xsi:type="string">Foo_Bar/js/fi<caret></item>
8+
</item>
9+
</argument>
10+
</dataSource>
11+
</form>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
4+
<fieldset name="general" >
5+
<field name="test_field" component="testF<caret>">
6+
</field>
7+
</fieldset>
8+
</form>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
4+
<dataSource name="test_source">
5+
<argument name="data" xsi:type="array">
6+
<item name="js_config" xsi:type="array">
7+
<item name="component" xsi:type="string">testF<caret></item>
8+
</item>
9+
</argument>
10+
</dataSource>
11+
</form>

0 commit comments

Comments
 (0)