From c86878eb245438f33bc0810234a76c59daa77755 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9E=97=E4=B8=87=E7=A8=8B?= <1498425439@qq.com>
Date: Wed, 9 Mar 2022 23:01:27 +0800
Subject: [PATCH] =?UTF-8?q?json=20doc=20support=20same=20name=20|=20json?=
=?UTF-8?q?=20=E6=B3=A8=E9=87=8A=E6=94=AF=E6=8C=81=E5=90=8C=E5=90=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 11 ++---------
.../plugin/show/doc/JsonDocUtils.java | 18 +++++++++++-------
src/main/resources/META-INF/plugin.xml | 11 ++---------
...b.linwancen.plugin.show.demo.java.obj.Face} | 0
4 files changed, 15 insertions(+), 25 deletions(-)
rename src/test/java/io/github/linwancen/plugin/show/demo/spi/{io.github.linwancen.plugin.show.demo.method.Face => io.github.linwancen.plugin.show.demo.java.obj.Face} (100%)
diff --git a/README.md b/README.md
index 242a844..7cd1e12 100644
--- a/README.md
+++ b/README.md
@@ -6,21 +6,14 @@ English Notes:
Show javadoc comments at the Project view Tree structure.
Show javadoc comments at the end-of-line.
Show javadoc comments at "xx ClassNameOrSimpleName.json".
-One of the above features can be turned off in
- settings -> Tools -> Show Comment Global
-Font color of end-of-line comments can be modified in
- settings -> Tools -> Show Comment Global
-Class name prefix filter of end-of-line comment can be modified in
- settings -> Tools -> Show Comment Project
+Config: settings -> Tools -> Show Comment Global/Project
Chinese Notes:
- 在结构树显示 文档注释。
- 在行末尾显示 文档注释。
- 支持 "xx 类全名或简名.json"。
-
- 可以在设置中 关闭 上面其中一个功能。
-
- 可以在设置中 修改 行末注释 的字体颜色。
-
- 可以在设置中 修改 行末注释 的类名前缀过滤。
+
- 修改配置:设置 -> 工具 -> Show Comment Global/Project
English Change Notes:
diff --git a/src/main/java/io/github/linwancen/plugin/show/doc/JsonDocUtils.java b/src/main/java/io/github/linwancen/plugin/show/doc/JsonDocUtils.java
index a2c4377..cf7acbc 100644
--- a/src/main/java/io/github/linwancen/plugin/show/doc/JsonDocUtils.java
+++ b/src/main/java/io/github/linwancen/plugin/show/doc/JsonDocUtils.java
@@ -46,13 +46,17 @@ public class JsonDocUtils {
continue;
}
if (level == 0) {
- return DocUtils.srcOrByteCodeDoc(psiField);
- }
- String classFullName = toClassFullName(psiField);
- PsiClass[] classes = PsiClassUtils.fullNameToClass(classFullName, project);
- PsiDocComment docComment = doc(classes, project, jsonPath, level - 1);
- if (docComment != null) {
- return docComment;
+ PsiDocComment docComment = DocUtils.srcOrByteCodeDoc(psiField);
+ if (docComment != null) {
+ return docComment;
+ }
+ } else {
+ String classFullName = toClassFullName(psiField);
+ PsiClass[] classes = PsiClassUtils.fullNameToClass(classFullName, project);
+ PsiDocComment docComment = doc(classes, project, jsonPath, level - 1);
+ if (docComment != null) {
+ return docComment;
+ }
}
}
return null;
diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml
index 7c169a7..d8af239 100644
--- a/src/main/resources/META-INF/plugin.xml
+++ b/src/main/resources/META-INF/plugin.xml
@@ -9,21 +9,14 @@ English Notes:
Show javadoc comments at the Project view Tree structure.
Show javadoc comments at the end-of-line.
Show javadoc comments at "xx ClassNameOrSimpleName.json".
-One of the above features can be turned off in
- settings -> Tools -> Show Comment Global
-Font color of end-of-line comments can be modified in
- settings -> Tools -> Show Comment Global
-Class name prefix filter of end-of-line comment can be modified in
- settings -> Tools -> Show Comment Project
+Config: settings -> Tools -> Show Comment Global/Project
Chinese Notes:
- 在结构树显示 文档注释。
- 在行末尾显示 文档注释。
- 支持 "xx 类全名或简名.json"。
-
- 可以在设置中 关闭 上面其中一个功能。
-
- 可以在设置中 修改 行末注释 的字体颜色。
-
- 可以在设置中 修改 行末注释 的类名前缀过滤。
+
- 修改配置:设置 -> 工具 -> Show Comment Global/Project
]]>
diff --git a/src/test/java/io/github/linwancen/plugin/show/demo/spi/io.github.linwancen.plugin.show.demo.method.Face b/src/test/java/io/github/linwancen/plugin/show/demo/spi/io.github.linwancen.plugin.show.demo.java.obj.Face
similarity index 100%
rename from src/test/java/io/github/linwancen/plugin/show/demo/spi/io.github.linwancen.plugin.show.demo.method.Face
rename to src/test/java/io/github/linwancen/plugin/show/demo/spi/io.github.linwancen.plugin.show.demo.java.obj.Face