Skip to content

Commit 6a27db2

Browse files
authored
Merge branch '2.1.0-develop' into issue-147
2 parents 4cadede + 71a0f9c commit 6a27db2

File tree

18 files changed

+385
-122
lines changed

18 files changed

+385
-122
lines changed

.github/workflows/gradle.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ name: Run automated tests
55

66
on:
77
pull_request:
8-
branches: [ master, 2.0.1-develop, 2.1.0-develop ]
8+
branches: [ master, 2.1.0-develop ]
99

1010
jobs:
1111
build-linux:

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0).
66

7+
## 2.0.2
8+
9+
### Added
10+
11+
- PWA pure function Live Template
12+
13+
### Fixed
14+
15+
- Library root for object manager autocomplete
16+
- Line marker for interface plugin target
17+
- Allowed theme override of non-magento composer themes
18+
- Issue with `Magento Module Ui Grid Collection Data Provider Php`
19+
720
## 2.0.1
821

922
### Fixed

resources/META-INF/plugin.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@
100100
<projectService serviceImplementation="com.magento.idea.magento2plugin.project.Settings"/>
101101

102102
<completion.contributor language="XML" implementationClass="com.magento.idea.magento2plugin.completion.xml.XmlCompletionContributor" id="xml" />
103+
<completion.contributor language="PHP" implementationClass="com.magento.idea.magento2plugin.completion.php.PhpCompletionContributor" id="php" />
103104

104105
<psi.referenceContributor language="XML" implementation="com.magento.idea.magento2plugin.reference.xml.XmlReferenceContributor"/>
105106
<psi.referenceContributor language="PHP" implementation="com.magento.idea.magento2plugin.reference.php.PhpReferenceContributor"/>
@@ -187,8 +188,6 @@
187188
enabledByDefault="true" level="ERROR"
188189
implementationClass="com.magento.idea.magento2plugin.inspections.xml.AclResourceXmlInspection"/>
189190

190-
<libraryRoot id=".phpstorm.meta.php" path=".phpstorm.meta.php/" runtime="false"/>
191-
192191
<internalFileTemplate name="Magento Module Composer"/>
193192
<internalFileTemplate name="Magento Module Registration Php"/>
194193
<internalFileTemplate name="Magento Module Xml"/>
@@ -205,20 +204,22 @@
205204
<internalFileTemplate name="Magento Module Controller Frontend Class"/>
206205
<internalFileTemplate name="Magento Module Cron Groups Xml"/>
207206
<internalFileTemplate name="Magento Module UI Component Grid Xml"/>
208-
<internalFileTemplate name="Magento Module Ui Grid Collection Data Provider Php"/>
209207
<internalFileTemplate name="Magento Module Ui Custom Data Provider Php"/>
210208
<internalFileTemplate name="Magento Module UI Component Form Xml"/>
211209
<internalFileTemplate name="Magento Php Form Button Block Class"/>
212210
<internalFileTemplate name="Magento Routes Xml"/>
213211
<internalFileTemplate name="Magento Module Layout Xml"/>
214212
<internalFileTemplate name="Magento Module ACL XML"/>
215213

214+
<defaultLiveTemplates file="/liveTemplates/MagentoPWA.xml"/>
215+
216216
<postStartupActivity implementation="com.magento.idea.magento2plugin.project.startup.CheckIfMagentoPathIsValidActivity"/>
217217
</extensions>
218218

219219
<extensions defaultExtensionNs="com.jetbrains.php">
220220
<frameworkProjectConfigurableProvider implementation="com.magento.idea.magento2plugin.project.ConfigurableProvider"/>
221221
<frameworkUsageProvider implementation="com.magento.idea.magento2plugin.project.UsagesProvider"/>
222+
<libraryRoot id="phpstorm.meta.php" path="/phpstorm.meta.php/" runtime="false"/>
222223
</extensions>
223224

224225
</idea-plugin>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<templateSet group="MagentoPWA">
3+
<template name="pwac" value="import React from 'react';&#10;import {mergeClasses} from '@magento/venia-ui/lib/classify';&#10;import { shape, string } from 'prop-types';&#10;&#10;import defaultClasses from './$CSS_FILENAME_BASE$.css';&#10;&#10;const $TM_FILENAME_BASE$ = props =&gt; {&#10; const classes = mergeClasses(defaultClasses, props.classes);&#10; return (&lt;div className={classes.root}&gt;$END$&lt;/div&gt;);&#10;}&#10;&#10;$TM_FILENAME_BASE$.propTypes = {&#10; classes: shape({root: string})&#10;};&#10;$TM_FILENAME_BASE$.defaultProps = {};&#10;export default $TM_FILENAME_BASE$;" description="Creates a PWA Studio pure function component" toReformat="true" toShortenFQNames="true">
4+
<variable name="CSS_FILENAME_BASE" expression="decapitalize(camelCase(fileNameWithoutExtension()))" defaultValue="" alwaysStopAt="true" />
5+
<variable name="TM_FILENAME_BASE" expression="capitalize(camelCase(fileNameWithoutExtension()))" defaultValue="" alwaysStopAt="true" />
6+
<context>
7+
<option name="JAVA_SCRIPT" value="true" />
8+
<option name="TypeScript" value="true" />
9+
</context>
10+
</template>
11+
</templateSet>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?php
2+
3+
namespace PHPSTORM_META {
4+
override(\Magento\Framework\ObjectManagerInterface::get(0), map(['' => '@']));
5+
override(\Magento\Framework\ObjectManagerInterface::create(0), map(['' => '@']));
6+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
package com.magento.idea.magento2plugin.completion.php;
7+
8+
import com.intellij.codeInsight.completion.CompletionContributor;
9+
import com.intellij.codeInsight.completion.CompletionType;
10+
import com.magento.idea.magento2plugin.completion.provider.ModuleNameCompletionProvider;
11+
import com.magento.idea.magento2plugin.util.php.PhpPatternsHelper;
12+
13+
@SuppressWarnings({
14+
"PMD.CallSuperInConstructor",
15+
})
16+
public class PhpCompletionContributor extends CompletionContributor {
17+
18+
/**
19+
* Constructor.
20+
*/
21+
public PhpCompletionContributor() {
22+
/*
23+
'modules' => [
24+
'Vendor_Module' => 1
25+
]
26+
*/
27+
extend(
28+
CompletionType.BASIC,
29+
PhpPatternsHelper.CONFIGPHP_COMPLETION,
30+
new ModuleNameCompletionProvider()
31+
);
32+
}
33+
}

src/com/magento/idea/magento2plugin/reference/php/PhpReferenceContributor.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,33 @@
22
* Copyright © Magento, Inc. All rights reserved.
33
* See COPYING.txt for license details.
44
*/
5+
56
package com.magento.idea.magento2plugin.reference.php;
67

78
import com.intellij.psi.PsiReferenceContributor;
89
import com.intellij.psi.PsiReferenceRegistrar;
9-
import com.magento.idea.magento2plugin.util.php.PhpPatternsHelper;
1010
import com.magento.idea.magento2plugin.reference.provider.EventDispatchReferenceProvider;
11+
import com.magento.idea.magento2plugin.reference.provider.ModuleNameReferenceProvider;
12+
import com.magento.idea.magento2plugin.util.php.PhpPatternsHelper;
1113
import org.jetbrains.annotations.NotNull;
1214

1315
public class PhpReferenceContributor extends PsiReferenceContributor {
1416
@Override
15-
public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {
17+
public void registerReferenceProviders(@NotNull final PsiReferenceRegistrar registrar) {
1618
// ->dispatch("event_name")
1719
registrar.registerReferenceProvider(
1820
PhpPatternsHelper.STRING_METHOD_ARGUMENT,
1921
new EventDispatchReferenceProvider()
2022
);
23+
24+
/*
25+
'modules' => [
26+
'Vendor_Module' => 1
27+
]
28+
*/
29+
registrar.registerReferenceProvider(
30+
PhpPatternsHelper.CONFIGPHP_MODULENAME,
31+
new ModuleNameReferenceProvider()
32+
);
2133
}
2234
}

src/com/magento/idea/magento2plugin/util/php/PhpPatternsHelper.java

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,51 @@
22
* Copyright © Magento, Inc. All rights reserved.
33
* See COPYING.txt for license details.
44
*/
5+
56
package com.magento.idea.magento2plugin.util.php;
67

78
import com.intellij.patterns.ElementPattern;
89
import com.intellij.patterns.PlatformPatterns;
10+
import com.intellij.patterns.StandardPatterns;
911
import com.intellij.psi.PsiElement;
1012
import com.jetbrains.php.lang.PhpLanguage;
13+
import com.jetbrains.php.lang.lexer.PhpTokenTypes;
1114
import com.jetbrains.php.lang.patterns.PhpPatterns;
15+
import com.jetbrains.php.lang.psi.elements.ArrayHashElement;
1216
import com.jetbrains.php.lang.psi.elements.ParameterList;
17+
import com.jetbrains.php.lang.psi.elements.PhpPsiElement;
18+
import com.jetbrains.php.lang.psi.elements.StringLiteralExpression;
1319

1420
public class PhpPatternsHelper {
1521
public static final ElementPattern<? extends PsiElement> STRING_METHOD_ARGUMENT =
16-
PhpPatterns
17-
.phpLiteralExpression()
18-
.withParent(
19-
PlatformPatterns
20-
.psiElement(ParameterList.class)
21-
.withParent(
22-
PhpPatterns
23-
.phpFunctionReference()
22+
PhpPatterns
23+
.phpLiteralExpression()
24+
.withParent(
25+
PlatformPatterns
26+
.psiElement(ParameterList.class)
27+
.withParent(
28+
PhpPatterns
29+
.phpFunctionReference()
30+
)
31+
).withLanguage(PhpLanguage.INSTANCE);
32+
33+
public static final ElementPattern<? extends PsiElement> CONFIGPHP_MODULENAME =
34+
PlatformPatterns.psiElement(StringLiteralExpression.class)
35+
.withSuperParent(5,PlatformPatterns.psiElement(ArrayHashElement.class)
36+
.withChild(PlatformPatterns.psiElement(PhpPsiElement.class)
37+
.withChild(PlatformPatterns.psiElement(StringLiteralExpression.class)
38+
.withText(StandardPatterns.string().contains("modules").withLength(9))
39+
)
40+
)
41+
);
42+
43+
public static final ElementPattern<? extends PsiElement> CONFIGPHP_COMPLETION =
44+
PlatformPatterns.psiElement(PhpTokenTypes.STRING_LITERAL_SINGLE_QUOTE)
45+
.withSuperParent(6, PlatformPatterns.psiElement(ArrayHashElement.class)
46+
.withChild(PlatformPatterns.psiElement(PhpPsiElement.class)
47+
.withChild(PlatformPatterns.psiElement(StringLiteralExpression.class)
48+
.withText(StandardPatterns.string().contains("modules").withLength(9))
49+
)
2450
)
25-
).withLanguage(PhpLanguage.INSTANCE);
51+
);
2652
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
return [
8+
'modules' => [
9+
'Magento_C<caret>' => 1
10+
]
11+
];
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
return [
8+
'moduless' => [
9+
'Magento_C<caret>' => 1
10+
]
11+
];

0 commit comments

Comments
 (0)