Skip to content

Commit 59a3f15

Browse files
author
Vitaliy
authored
Merge branch '2.1.0-develop' into issue-287
2 parents aa261a3 + 71bbf42 commit 59a3f15

File tree

23 files changed

+432
-135
lines changed

23 files changed

+432
-135
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

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,19 @@
44
[![Downloads](http://phpstorm.espend.de/badge/8024/downloads)](https://plugins.jetbrains.com/plugin/8024)
55
[![Downloads last month](http://phpstorm.espend.de/badge/8024/last-month)](https://plugins.jetbrains.com/plugin/8024)
66

7-
This is a plugin for Magento 2 development in the PhpStorm IDE. It is available via the [JetBrains Plugin Repository](https://plugins.jetbrains.com/plugin/8024)
7+
This is a PhpStorm IDE plugin for a better Magento 2 development workflow. It is available via the [JetBrains Plugin Repository](https://plugins.jetbrains.com/plugin/8024)
8+
89
## Installation
910

1011
1. Go to `Settings > Preferences` in the PhpStorm IDE
1112
2. Navigate to `Plugins`
1213
3. Click the `Browse repositories...` button and search for "Magento PhpStorm"
1314
4. Install the plugin and restart PhpStorm
1415
5. Go to `Settings > Preferences > Languages & Frameworks > PHP > Frameworks > Magento` in the PhpStorm IDE
15-
6. Check `Enable` and `OK` button.
16+
6. Check `Enable` and click the `OK` button
1617

1718
## Works with
19+
1820
* PhpStorm >= 2020.1.1
1921
* JRE >= 1.8
2022

@@ -48,11 +50,12 @@ This is a plugin for Magento 2 development in the PhpStorm IDE. It is available
4850
- **Enhancement** - Know how to improve existing functionality? Open an issue describe how to enhance the plugin.
4951
- **New feature proposal** - Know how to make a killer feature? Do not hesitate to submit your proposal.
5052
3) The issue will appear in the `Ready for Grooming` column of the [Community Backlog](https://github.com/magento/magento2-phpstorm-plugin/projects/2). Once it will be discussed and approved the issue will be ready for development.
53+
4) Refer to the [Contributing Guide](https://github.com/magento/magento2-phpstorm-plugin/blob/2.1.0-develop/.github/CONTRIBUTING.md) for more information on how to contribute.
5154

52-
### <img src="https://upload.wikimedia.org/wikipedia/commons/7/76/Slack_Icon.png" width="20"> Join [#phpstorm-plugin](https://magentocommeng.slack.com/archives/C010C2LUCEA) Slack channel for more details.
53-
55+
### <img src="https://upload.wikimedia.org/wikipedia/commons/7/76/Slack_Icon.png" width="20"> Join the [#phpstorm-plugin](https://magentocommeng.slack.com/archives/C010C2LUCEA) Slack channel to get more involved
5456

5557
## License
58+
5659
Each Magento source file included in this distribution is licensed under OSL-3.0 license.
5760

58-
Please see [LICENSE.txt](https://github.com/magento/magento2-phpstorm-plugin/blob/master/LICENSE.txt) for the full text of the [Open Software License v. 3.0 (OSL-3.0)](http://opensource.org/licenses/osl-3.0.php).
61+
Please read the [LICENSE.txt](https://github.com/magento/magento2-phpstorm-plugin/blob/master/LICENSE.txt) for the full text of the [Open Software License v. 3.0 (OSL-3.0)](http://opensource.org/licenses/osl-3.0.php).

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>

resources/magento2/inspection.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
inspection.plugin.duplicateInSameFile=The plugin name already used in this file. For more details see Inspection Description.
22
inspection.plugin.duplicateInOtherPlaces=The plugin name "{0}" for targeted "{1}" class is already used in the module "{2}" ({3} scope). For more details see Inspection Description.
3+
inspection.plugin.disabledPluginDoesNotExist=This plugin does not exist to be disabled.
34
inspection.graphql.resolver.mustImplement=Class must implements any of the following interfaces: \\Magento\\Framework\\GraphQl\\Query\\ResolverInterface, \\Magento\\Framework\\GraphQl\\Query\\Resolver\\BatchResolverInterface, \\Magento\\Framework\\GraphQl\\Query\\Resolver\\BatchServiceContractResolverInterface
45
inspection.graphql.resolver.notExist=Resolver class do not exist
56
inspection.graphql.resolver.fix.family=Implement Resolver interface
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/inspections/xml/PluginDeclarationInspection.java

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,10 @@ public void visitFile(final PsiFile file) {
6161

6262
final HashMap<String, XmlTag> targetPluginHash = new HashMap<>();
6363
final PluginIndex pluginIndex = PluginIndex.getInstance(file.getProject());
64+
final HashMap<String, XmlTag> pluginProblems = new HashMap<>();
6465

6566
for (final XmlTag pluginXmlTag: xmlTags) {
66-
final HashMap<String, XmlTag> pluginProblems = new HashMap<>();
67+
pluginProblems.clear();
6768
if (!pluginXmlTag.getName().equals(ModuleDiXml.TYPE_TAG)) {
6869
continue;
6970
}
@@ -84,13 +85,7 @@ public void visitFile(final PsiFile file) {
8485
final XmlAttribute pluginTypeDisabledAttribute
8586
= pluginTypeXmlTag.getAttribute(ModuleDiXml.DISABLED_ATTR_NAME);
8687

87-
if (pluginTypeNameAttribute == null
88-
|| (
89-
pluginTypeDisabledAttribute != null //NOPMD
90-
&& pluginTypeDisabledAttribute.getValue() != null
91-
&& pluginTypeDisabledAttribute.getValue().equals("true")
92-
)
93-
) {
88+
if (pluginTypeNameAttribute == null) {
9489
continue;
9590
}
9691

@@ -116,6 +111,21 @@ public void visitFile(final PsiFile file) {
116111
pluginIndex,
117112
file
118113
);
114+
115+
if (pluginTypeDisabledAttribute != null
116+
&& pluginTypeDisabledAttribute.getValue() != null
117+
&& pluginTypeDisabledAttribute.getValue().equals("true")
118+
&& modulesWithSamePluginName.isEmpty()
119+
) {
120+
problemsHolder.registerProblem(
121+
pluginTypeNameAttribute.getValueElement(),
122+
inspectionBundle.message(
123+
"inspection.plugin.disabledPluginDoesNotExist"
124+
),
125+
errorSeverity
126+
);
127+
}
128+
119129
for (final Pair<String, String> moduleEntry: modulesWithSamePluginName) {
120130
final String scope = moduleEntry.getFirst();
121131
final String moduleName = moduleEntry.getSecond();

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
}

0 commit comments

Comments
 (0)