Skip to content

Commit

Permalink
build: 构建2.1.5版本
Browse files Browse the repository at this point in the history
  • Loading branch information
threefish committed Mar 27, 2021
1 parent 535332d commit 4c617db
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 23 deletions.
Binary file modified release/NutzCodeInsight_2.1.5_20210327.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<name>NutzCodeInsight</name>
<version>2.1.5</version>
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html for description -->
<idea-version since-build="201"/>
<idea-version since-build="203"/>
<vendor email="[email protected]" url="https://gitee.com/threefish/NutzCodeInsight">threefish</vendor>
<description><![CDATA[
<h1>Intellij idea plugin for <a href="https://github.com/nutzam/nutz">Nutz</a></h1>
Expand Down
26 changes: 16 additions & 10 deletions src/com/sgaop/idea/annotator/JavaSqlXmlAnnotator.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.sgaop.idea.annotator;

import com.intellij.lang.annotation.Annotation;
import com.intellij.lang.annotation.AnnotationBuilder;
import com.intellij.lang.annotation.AnnotationHolder;
import com.intellij.lang.annotation.HighlightSeverity;
import com.intellij.openapi.util.TextRange;
Expand Down Expand Up @@ -33,16 +33,22 @@ public boolean isSqlsXml(@NotNull PsiElement psiElement) {
*/
@Override
public void process(@NotNull PsiElement psiElement, @NotNull AnnotationHolder annotationHolder) {
List<VirtualFile> virtualFileList = SqlsXmlUtil.findTemplteFileList(psiElement);
if (virtualFileList.size() == 0) {
TextRange textRange;
if (psiElement.getNextSibling().getChildren().length == 0) {
textRange = psiElement.getTextRange();
} else {
textRange = new TextRange(psiElement.getTextRange().getStartOffset(), psiElement.getNextSibling().getTextRange().getEndOffset());
try {
List<VirtualFile> virtualFileList = SqlsXmlUtil.findTemplteFileList(psiElement);
if (virtualFileList.size() == 0) {
TextRange textRange;
if (psiElement.getNextSibling().getChildren().length == 0) {
textRange = psiElement.getTextRange();
} else {
textRange = new TextRange(psiElement.getTextRange().getStartOffset(), psiElement.getNextSibling().getTextRange().getEndOffset());
}
AnnotationBuilder annotationBuilder = annotationHolder.newAnnotation(HighlightSeverity.ERROR, ERR_MSG);
annotationBuilder.range(textRange);
AnnotationBuilder.FixBuilder fixBuilder = annotationBuilder.newFix(new GenerateSqlXmlIntention());
fixBuilder.registerFix();
annotationBuilder.create();
}
Annotation annotation = new Annotation(textRange.getStartOffset(), textRange.getEndOffset(), HighlightSeverity.ERROR, ERR_MSG, null);
annotation.registerFix(new GenerateSqlXmlIntention());
} catch (Exception e) {
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -137,21 +137,24 @@ private List<PsiElement> getImplListElements(String name, String qualifiedName,

private HashMap<String, List<PsiElement>> getMethodIocBeans(Project project, GlobalSearchScope moduleScope) {
HashMap<String, List<PsiElement>> elementHashMap = new HashMap<>(1);
Collection<PsiAnnotation> psiAnnotationCollection = JavaAnnotationIndex.getInstance().get("IocBean", project, moduleScope);
for (PsiAnnotation psiAnnotation : psiAnnotationCollection) {
if (psiAnnotation.getParent() instanceof PsiModifierList) {
if (psiAnnotation.getParent().getParent() instanceof PsiMethod) {
PsiMethod method = (PsiMethod) psiAnnotation.getParent().getParent();
String returnQualifiedName = method.getReturnType().getCanonicalText();
if (elementHashMap.containsKey(returnQualifiedName)) {
elementHashMap.get(returnQualifiedName).add(method);
} else {
List<PsiElement> arr = new ArrayList<>();
arr.add(method);
elementHashMap.put(returnQualifiedName, arr);
try {
Collection<PsiAnnotation> psiAnnotationCollection = JavaAnnotationIndex.getInstance().get("IocBean", project, moduleScope);
for (PsiAnnotation psiAnnotation : psiAnnotationCollection) {
if (psiAnnotation.getParent() instanceof PsiModifierList) {
if (psiAnnotation.getParent().getParent() instanceof PsiMethod) {
PsiMethod method = (PsiMethod) psiAnnotation.getParent().getParent();
String returnQualifiedName = method.getReturnType().getCanonicalText();
if (elementHashMap.containsKey(returnQualifiedName)) {
elementHashMap.get(returnQualifiedName).add(method);
} else {
List<PsiElement> arr = new ArrayList<>();
arr.add(method);
elementHashMap.put(returnQualifiedName, arr);
}
}
}
}
} catch (Exception e) {
}
return elementHashMap;
}
Expand Down

0 comments on commit 4c617db

Please sign in to comment.