Skip to content

Commit

Permalink
Merge pull request #417 from magento/skip-idea-include-during-indexing
Browse files Browse the repository at this point in the history
Skip IDEA include tag
  • Loading branch information
coderimus authored Dec 13, 2020
2 parents 1fca5ce + 84041d5 commit f72e224
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0).

## 3.0.1

### Fixed

- Skipped IDEA include tag causing error
- Fixed StringIndexOutOfBoundsException on PluginInspection

## 3.0.0

### Added
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ This is a PhpStorm IDE plugin for a better Magento 2 development workflow. It is

## Works with

* PhpStorm >= 2020.1.1
* JRE >= 1.8
* PhpStorm >= 2020.3
* JRE >= 11

## Features

Expand Down
2 changes: 1 addition & 1 deletion resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<vendor url="https://github.com/magento/magento2-phpstorm-plugin">Magento Inc.</vendor>

<description><![CDATA[
Magento PhpStorm plugin, created to improve life-work balance while working with Magento 2
This is a PhpStorm IDE plugin for a better Magento 2 development workflow.
]]></description>

<change-notes><![CDATA[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
import com.jetbrains.php.lang.PhpLangUtil;
import com.magento.idea.magento2plugin.project.Settings;
import com.magento.idea.magento2plugin.util.RegExUtil;
import com.magento.idea.magento2plugin.util.xml.XmlPsiTreeUtil;
import gnu.trove.THashMap;
import java.util.List;
import java.util.Map;
import org.jetbrains.annotations.NotNull;

Expand Down Expand Up @@ -65,7 +67,7 @@ public DataIndexer<String, Void, FileContent> getIndexer() {
};
}

private void fillMap(final XmlTag parentTag, final Map<String, Void> resultMap) {
private void fillMap(final XmlTag parentTag, final Map<String, Void> resultMap) { //NOPMD
for (final XmlTag childTag: parentTag.getSubTags()) {
for (final XmlAttribute xmlAttribute: childTag.getAttributes()) {
final String xmlAttributeValue = xmlAttribute.getValue();
Expand All @@ -79,6 +81,16 @@ private void fillMap(final XmlTag parentTag, final Map<String, Void> resultMap)
if (XmlIncludeHandler.isXInclude(childTag)) {
return;
}

//skipping IDEA include tag
final List<XmlTag> ideaIncludeTags = XmlPsiTreeUtil.findSubTagsOfParent(
childTag,
"xi:include"
);
if (!ideaIncludeTags.isEmpty()) {
return;
}

final XmlTagValue childTagValue = childTag.getValue();
final String tagValue = childTagValue.getTrimmedText();
if (!tagValue.isEmpty() && tagValue.matches(CLASS_NAME_PATTERN)) {
Expand Down

0 comments on commit f72e224

Please sign in to comment.