-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
1,506 additions
and
290 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,34 @@ | ||
<idea-plugin version="2"> | ||
<id>com.yii2support</id> | ||
<name>Yii2 Support</name> | ||
<version>0.2.2</version> | ||
<version>0.2.10.9</version> | ||
<vendor email="[email protected]" url="http://nvlad.com">NVlad</vendor> | ||
|
||
<description><![CDATA[ | ||
Yii2 Support for PhpStorm<br/> | ||
<br/> | ||
<strong>Features</strong> | ||
<ul> | ||
<li>Views (autocomplete, jump to view)</li> | ||
<li>i18n (autocomplete, generate params array)</li> | ||
<li> | ||
Views<br/> | ||
- View files completion<br/> | ||
- Add View parameters after completion<br/> | ||
- Inspection missed View files<br/> | ||
- QuickFix for missed files<br/> | ||
- Jump to View file (go to declaration)<br/> | ||
- Inspection by required & unused parameters for View render<br/> | ||
- QuickFix for required & unused parameters<br/> | ||
- Update path to View file on file move<br/> | ||
</li> | ||
<li>i18n (completion, generate params array)</li> | ||
</ul> | ||
]]></description> | ||
|
||
<change-notes><![CDATA[ | ||
<ul> | ||
<li>Fix show autocompletion popup</li> | ||
<li>Update path to View file on file move</li> | ||
<li>Fixed replace View path on file rename</li> | ||
<li>Fix mark as error view paths started with "//" or "@" (references to files is not work)</li> | ||
</ul> | ||
]]> | ||
</change-notes> | ||
|
@@ -33,8 +45,27 @@ | |
<depends>com.intellij.modules.platform</depends> | ||
|
||
<extensions defaultExtensionNs="com.intellij"> | ||
<completion.contributor language="PHP" implementationClass="com.yii2support.views.CompletionContributor"/> | ||
<psi.referenceContributor language="PHP" implementation="com.yii2support.views.PsiReferenceContributor"/> | ||
<!-- Views --> | ||
<completion.contributor language="PHP" implementationClass="com.yii2support.views.completion.CompletionContributor"/> | ||
<psi.referenceContributor language="PHP" implementation="com.yii2support.views.references.PsiReferenceContributor"/> | ||
<renamePsiElementProcessor implementation="com.yii2support.views.refactor.RenameViewProcessor"/> | ||
<localInspection language="PHP" shortName="MissedViewInspection" | ||
displayName="Missing View file" | ||
groupName="Views" groupPath="PHP,Framework,Yii2" | ||
enabledByDefault="true" level="ERROR" | ||
implementationClass="com.yii2support.views.inspections.MissedViewInspection"/> | ||
<localInspection language="PHP" shortName="RequireParameterInspection" | ||
displayName="Require parameters" | ||
groupName="Views" groupPath="PHP,Framework,Yii2" | ||
enabledByDefault="true" level="ERROR" | ||
implementationClass="com.yii2support.views.inspections.RequireParameterInspection"/> | ||
<localInspection language="PHP" shortName="UnusedParameterInspection" | ||
displayName="Unused parameters" | ||
groupName="Views" groupPath="PHP,Framework,Yii2" | ||
enabledByDefault="true" level="WARNING" | ||
implementationClass="com.yii2support.views.inspections.UnusedParameterInspection"/> | ||
|
||
<!-- i18n --> | ||
<completion.contributor language="PHP" implementationClass="com.yii2support.i18n.CompletionContributor"/> | ||
</extensions> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<html> | ||
<body> | ||
Check for View file existing | ||
<!-- tooltip end --> | ||
<p> | ||
- QuickFix - create View file | ||
</p> | ||
</body> | ||
</html> |
5 changes: 5 additions & 0 deletions
5
resources/inspectionDescriptions/RequireParameterInspection.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<html> | ||
<body> | ||
View require parameters | ||
</body> | ||
</html> |
5 changes: 5 additions & 0 deletions
5
resources/inspectionDescriptions/UnusedParameterInspection.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<html> | ||
<body> | ||
Detecting unused View parameters. | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.yii2support.common; | ||
|
||
import com.jetbrains.php.lang.psi.elements.ArrayCreationExpression; | ||
import com.jetbrains.php.lang.psi.elements.ArrayHashElement; | ||
import com.jetbrains.php.lang.psi.elements.StringLiteralExpression; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.Collection; | ||
import java.util.HashSet; | ||
|
||
/** | ||
* Created by NVlad on 23.01.2017. | ||
*/ | ||
public class PhpUtil { | ||
@NotNull | ||
public static Collection<String> getArrayKeys(ArrayCreationExpression array) { | ||
final HashSet<String> result = new HashSet<>(); | ||
|
||
Iterable<ArrayHashElement> items = array.getHashElements(); | ||
|
||
for (ArrayHashElement item : items) { | ||
if (item.getKey() != null && item.getKey() instanceof StringLiteralExpression) { | ||
result.add(((StringLiteralExpression) item.getKey()).getContents()); | ||
} | ||
} | ||
|
||
return result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.yii2support.common; | ||
|
||
import com.intellij.psi.PsiElement; | ||
import com.intellij.psi.PsiWhiteSpace; | ||
import com.jetbrains.php.lang.psi.elements.ArrayCreationExpression; | ||
|
||
/** | ||
* Created by NVlad on 17.01.2017. | ||
*/ | ||
public class PsiUtil { | ||
public static void deleteArrayElement(PsiElement element) { | ||
PsiElement next = element.getNextSibling(); | ||
String endArray = ((ArrayCreationExpression) element.getParent()).isShortSyntax() ? "]" : ")"; | ||
|
||
if (next instanceof PsiWhiteSpace && next.getNextSibling().getText() != null) { | ||
if (next.getNextSibling().getText().equals(endArray)) { | ||
next = next.getNextSibling(); | ||
} | ||
} | ||
if (next.getText().equals(endArray)) { | ||
Boolean deleteComma = false; | ||
if (element.getPrevSibling() instanceof PsiWhiteSpace) { | ||
deleteComma = !element.getPrevSibling().getText().contains("\n"); | ||
element.getPrevSibling().delete(); | ||
} | ||
if (deleteComma && element.getPrevSibling().getText().equals(",")) { | ||
element.getPrevSibling().delete(); | ||
} | ||
} | ||
if (next.getText().equals(",")) { | ||
if (next.getNextSibling() instanceof PsiWhiteSpace) { | ||
next.getNextSibling().delete(); | ||
} | ||
next.delete(); | ||
} | ||
element.delete(); | ||
} | ||
|
||
public static void deleteFunctionParam(PsiElement element) { | ||
PsiElement next = element.getNextSibling(); | ||
if (next != null && next.getText().equals(",")) { | ||
next.delete(); | ||
} else { | ||
PsiElement prev = element.getPrevSibling(); | ||
if (prev != null && prev instanceof PsiWhiteSpace) { | ||
prev.delete(); | ||
prev = element.getPrevSibling(); | ||
} | ||
if (prev != null && prev.getText().equals(",")) { | ||
prev.delete(); | ||
} | ||
} | ||
element.delete(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.