diff --git a/README.md b/README.md
index d820d70..185375b 100644
--- a/README.md
+++ b/README.md
@@ -34,10 +34,10 @@ Show doc comment in the Project view Tree, line End, json, other
Reload: Tools -> 🔄 // Reload External Comment
path/[any][filename.]ext.tree.tsv // file and folder tree comment 📝 📁
- path/[any][filename.]ext.key.tsv // line keywords to split and comment
+ path/[any][filename.]ext.key.regexp // line keywords to split and comment
path/[any][filename.]ext.doc.tsv // line words comment
In path, "doc" can replace any, and can use % like in SQL, effect at previous layer when folder named -1
- The lines in key.tsv will be concatenated with `|` to regexp; longer str should in front; startWith `?` to exclude
+ The lines in key.regexp will be concatenated with `|` to regexp; longer str should in front; startWith `?` to exclude
Chang tsv file in find pop window would not reload!
The tsv conf file must could be search in "Go to File" (Ctrl + Shift + N)
@@ -78,9 +78,9 @@ Show doc comment in the Project view Tree, line End, json, other
重新加载:工具 -> "🔄 // Reload External Comment"
path/[any][filename.]ext.tree.tsv // 文件(夹)注释 📝 📁
- path/[any][filename.]ext.key.tsv // 切割关键字与注释
+ path/[any][filename.]ext.key.regexp // 切割关键字与注释
path/[any][filename.]ext.doc.tsv // 词注释
- key.tsv 的每一行将会用`|`连接起来形成正则表达式,较长的关键字应该放在前面,用 `?` 开头排除
+ key.regexp 的每一行将会用`|`连接起来形成正则表达式,较长的关键字应该放在前面,用 `?` 开头排除
doc 文件夹可以替换任何一层文件夹,可以像 SQL 那样用 % 模糊匹配,文件夹名为 -1 时在上一层文件夹生效
在搜索弹出窗中修改 tsv 文件将不会被重加载
tsv 配置文件必须能被搜索(Ctrl + Shift + N)
@@ -104,12 +104,11 @@ Show doc comment in the Project view Tree, line End, json, other
-找个女朋友
+反馈问题和需求
-我的情况:1993-11-03,软件工程师,广发银行编制,宅,LOLm,NS,看书,写文章,KTV,爬山,逛街
- 我的性格:ISFP(探险家 内向 实际 感性 随性)
- 希望对方:广东省,与家人关系好,爱笑甜美大眼睛
- 有兴趣请联系 1498425439@qq.com,也欢迎反馈问题和需求
+GitHub issues
+ 微信 LinWanCen
+ 邮箱 1498425439@qq.com
@@ -126,6 +125,7 @@ Show doc comment in the Project view Tree, line End, json, other
English Change Notes:
+2.17 Add External Comment support *.key.regexp and MyBatis xml demo in Git
2.16 Add line-end-comment support Rust, Ruby, PHP, C/C++/Object C, Scala, Groovy
2.15 Add line-end-comment java anno doc
2.14 Add line-end-comment java enum doc for Yes(1, "Yes")
@@ -171,6 +171,7 @@ Show doc comment in the Project view Tree, line End, json, other
中文更新说明:
+2.17 增加 tsv 注释 支持 *.key.regexp 与 Mybatis xml 示例在 Git
2.16 增加 行末注释 支持 Rust, Ruby, PHP, C/C++/Object C, Scala, Groovy
2.15 增加 行末注释 java 注解注释
2.14 增加 行末注释 java 枚举注释用于 Yes(1, "是")
diff --git a/build.gradle b/build.gradle
index 773a155..b00cd7f 100644
--- a/build.gradle
+++ b/build.gradle
@@ -4,7 +4,7 @@ plugins {
}
group 'io.github.linwancen'
-version '2.16.0.' + (new Date().format('yyyy.MM.dd_HH.mm'))
+version '2.17.0.' + (new Date().format('yyyy.MM.dd_HH.mm'))
repositories {
mavenCentral()
@@ -95,6 +95,7 @@ patchPluginXml {
changeNotes = """
English Change Notes:
+2.17 Add External Comment support *.key.regexp and MyBatis xml demo in Git
2.16 Add line-end-comment support Rust, Ruby, PHP, C/C++/Object C, Scala, Groovy
2.15 Add line-end-comment java anno doc
2.14 Add line-end-comment java enum doc for Yes(1, "Yes")
@@ -140,6 +141,7 @@ patchPluginXml {
中文更新说明:
+2.17 增加 tsv 注释 支持 *.key.regexp 与 Mybatis xml 示例在 Git
2.16 增加 行末注释 支持 Rust, Ruby, PHP, C/C++/Object C, Scala, Groovy
2.15 增加 行末注释 java 注解注释
2.14 增加 行末注释 java 枚举注释用于 Yes(1, "是")
diff --git a/src/main/java/io/github/linwancen/plugin/show/ext/conf/ConfCache.java b/src/main/java/io/github/linwancen/plugin/show/ext/conf/ConfCache.java
index 917f6b8..62fb5d9 100644
--- a/src/main/java/io/github/linwancen/plugin/show/ext/conf/ConfCache.java
+++ b/src/main/java/io/github/linwancen/plugin/show/ext/conf/ConfCache.java
@@ -132,6 +132,12 @@ public class ConfCache {
load(file);
sb.append(file.getName()).append("\n");
}
+ @NotNull Collection files2 = FilenameIndex.getAllFilesByExt(project,
+ TsvLoader.REGEXP_EXT);
+ for (@NotNull VirtualFile file : files2) {
+ load(file);
+ sb.append(file.getName()).append("\n");
+ }
if (files.isEmpty()) {
return;
}
@@ -143,6 +149,9 @@ public class ConfCache {
}
public static void loadFile(@NotNull VirtualFile file, @Nullable Project project) {
+ if (!TsvLoader.EXT.equals(file.getExtension()) && !TsvLoader.REGEXP_EXT.equals(file.getExtension())) {
+ return;
+ }
ApplicationManager.getApplication().invokeLater(() -> {
ConfCache.load(file);
if (project != null && !project.isDisposed()) {
@@ -152,9 +161,6 @@ public class ConfCache {
}
private static void load(@NotNull VirtualFile file) {
- if (!TsvLoader.EXT.equals(file.getExtension())) {
- return;
- }
@NotNull String name = file.getNameWithoutExtension();
if (name.endsWith(KEY_MID_EXT)) {
@NotNull String matchName = name.substring(0, name.length() - KEY_MID_EXT.length());
diff --git a/src/main/java/io/github/linwancen/plugin/show/ext/conf/TsvLoader.java b/src/main/java/io/github/linwancen/plugin/show/ext/conf/TsvLoader.java
index 235b0a9..cb97266 100644
--- a/src/main/java/io/github/linwancen/plugin/show/ext/conf/TsvLoader.java
+++ b/src/main/java/io/github/linwancen/plugin/show/ext/conf/TsvLoader.java
@@ -19,6 +19,7 @@ public class TsvLoader {
private TsvLoader() {}
public static final String EXT = "tsv";
+ public static final String REGEXP_EXT = "regexp";
private static final Pattern LINE_PATTERN = Pattern.compile("[\\r\\n]++");
public static final Pattern DEL_PATTERN = Pattern.compile("\\(\\?[^)]++\\)");
diff --git a/src/main/java/io/github/linwancen/plugin/show/ext/conf/listener/ConfFileListener.java b/src/main/java/io/github/linwancen/plugin/show/ext/conf/listener/ConfFileListener.java
index 08c6e56..770d233 100644
--- a/src/main/java/io/github/linwancen/plugin/show/ext/conf/listener/ConfFileListener.java
+++ b/src/main/java/io/github/linwancen/plugin/show/ext/conf/listener/ConfFileListener.java
@@ -2,7 +2,11 @@ package io.github.linwancen.plugin.show.ext.conf.listener;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.newvfs.BulkFileListener;
-import com.intellij.openapi.vfs.newvfs.events.*;
+import com.intellij.openapi.vfs.newvfs.events.VFileCopyEvent;
+import com.intellij.openapi.vfs.newvfs.events.VFileDeleteEvent;
+import com.intellij.openapi.vfs.newvfs.events.VFileEvent;
+import com.intellij.openapi.vfs.newvfs.events.VFileMoveEvent;
+import com.intellij.openapi.vfs.newvfs.events.VFilePropertyChangeEvent;
import io.github.linwancen.plugin.show.ext.conf.ConfCache;
import io.github.linwancen.plugin.show.ext.conf.TsvLoader;
import org.jetbrains.annotations.NotNull;
@@ -35,20 +39,20 @@ public class ConfFileListener implements BulkFileListener {
if (file == null) {
return;
}
+ if (event instanceof VFileMoveEvent) {
+ return;
+ }
if (event instanceof VFilePropertyChangeEvent) {
@NotNull VFilePropertyChangeEvent changeEvent = (VFilePropertyChangeEvent) event;
if ("name".equals(changeEvent.getPropertyName())) {
String oldName = changeEvent.getOldValue().toString();
- if (oldName.endsWith(TsvLoader.EXT)) {
+ if (oldName.endsWith(TsvLoader.EXT) || oldName.endsWith(TsvLoader.REGEXP_EXT)) {
// change cache too complicated so remove
ConfCache.remove(file, oldName);
}
}
}
- if (!TsvLoader.EXT.equals(file.getExtension())) {
- return;
- }
- if (event instanceof VFileMoveEvent) {
+ if (!TsvLoader.EXT.equals(file.getExtension()) && !TsvLoader.REGEXP_EXT.equals(file.getExtension())) {
return;
}
if (event instanceof VFileDeleteEvent) {
diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml
index 092063f..9c44d39 100644
--- a/src/main/resources/META-INF/plugin.xml
+++ b/src/main/resources/META-INF/plugin.xml
@@ -30,58 +30,58 @@ Show doc comment in the Project view Tree, line End, json, other
External Comment
Demo(GitHub)
-Reload: Tools -> 🔄 // Reload External Comment
- path/[any][filename.]ext.tree.tsv // file and folder tree comment 📝 📁
- path/[any][filename.]ext.key.tsv // line keywords to split and comment
- path/[any][filename.]ext.doc.tsv // line words comment
- In path, "doc" can replace any, and can use % like in SQL, effect at previous layer when folder named -1
- The lines in key.tsv will be concatenated with `|` to regexp; longer str should in front; startWith `?` to exclude
- Chang tsv file in find pop window would not reload!
- The tsv conf file must could be search in "Go to File" (Ctrl + Shift + N)
+ Reload: Tools -> 🔄 // Reload External Comment
+ path/[any][filename.]ext.tree.tsv // file and folder tree comment 📝 📁
+ path/[any][filename.]ext.key.regexp // line keywords to split and comment
+ path/[any][filename.]ext.doc.tsv // line words comment
+ In path, "doc" can replace any, and can use % like in SQL, effect at previous layer when folder named -1
+ The lines in key.regexp will be concatenated with `|` to regexp; longer str should in front; startWith `?` to exclude
+ Chang tsv file in find pop window would not reload!
+ The tsv conf file must could be search in "Go to File" (Ctrl + Shift + N)
My Project
-Show doc comment at the Project view Tree, line End, json etc.:
-Show Comment
-
-show line count for file / method, show children count for dir in project view (tree on left):
-Line Num
-
-Method call usage graph and maven dependency graph:
-Draw Graph
-
-Find author/comment of multiple files or lines and export Find:
-Find Author
- Auto sync coverage and capture coverage during debug:
-Sync Coverage
+ Show doc comment at the Project view Tree, line End, json etc.:
+ Show Comment
+
+ show line count for file / method, show children count for dir in project view (tree on left):
+ Line Num
+
+ Method call usage graph and maven dependency graph:
+ Draw Graph
+
+ Find author/comment of multiple files or lines and export Find:
+ Find Author
+ Auto sync coverage and capture coverage during debug:
+ Sync Coverage
中文说明
-在结构树显示 文件注释 或 项目说明 (README.md pom.xml 等,可设置)
- 在行末尾显示 引用对象的文档注释,欢迎反馈您想要支持的语言,欢迎 C# 大神研究 CsLineEnd.java
- 输入 doc / docc 等生成 /** */
- json 字段注释从 xxx.json.tsv 读取
- json 字典注释从 键名.tsv 读取
- 支持 "xx-类全名或简名.json" 读取字段注释和跳转
- 支持 从配置文件获取外部注释用于文件夹、资源、COBOL 等
- 修改配置:设置 -> 工具 -> // Show Comment App/Global/Project
+ 在结构树显示 文件注释 或 项目说明 (README.md pom.xml 等,可设置)
+ 在行末尾显示 引用对象的文档注释,欢迎反馈您想要支持的语言,欢迎 C# 大神研究 CsLineEnd.java
+ 输入 doc / docc 等生成 /** */
+ json 字段注释从 xxx.json.tsv 读取
+ json 字典注释从 键名.tsv 读取
+ 支持 "xx-类全名或简名.json" 读取字段注释和跳转
+ 支持 从配置文件获取外部注释用于文件夹、资源、COBOL 等
+ 修改配置:设置 -> 工具 -> // Show Comment App/Global/Project
外部注释
示例(Gitee)
:比如你要给 .go 的文件配置文件注释可以放在相同目录或父目录的 xxx.go.tree.tsv 中
-重新加载:工具 -> "🔄 // Reload External Comment"
- path/[any][filename.]ext.tree.tsv // 文件(夹)注释 📝 📁
- path/[any][filename.]ext.key.tsv // 切割关键字与注释
- path/[any][filename.]ext.doc.tsv // 词注释
- key.tsv 的每一行将会用`|`连接起来形成正则表达式,较长的关键字应该放在前面,用 `?` 开头排除
- doc 文件夹可以替换任何一层文件夹,可以像 SQL 那样用 % 模糊匹配,文件夹名为 -1 时在上一层文件夹生效
- 在搜索弹出窗中修改 tsv 文件将不会被重加载
- tsv 配置文件必须能被搜索(Ctrl + Shift + N)
+ 重新加载:工具 -> "🔄 // Reload External Comment"
+ path/[any][filename.]ext.tree.tsv // 文件(夹)注释 📝 📁
+ path/[any][filename.]ext.key.regexp // 切割关键字与注释
+ path/[any][filename.]ext.doc.tsv // 词注释
+ key.regexp 的每一行将会用`|`连接起来形成正则表达式,较长的关键字应该放在前面,用 `?` 开头排除
+ doc 文件夹可以替换任何一层文件夹,可以像 SQL 那样用 % 模糊匹配,文件夹名为 -1 时在上一层文件夹生效
+ 在搜索弹出窗中修改 tsv 文件将不会被重加载
+ tsv 配置文件必须能被搜索(Ctrl + Shift + N)
我的项目
@@ -102,12 +102,11 @@ Show doc comment in the Project view Tree, line End, json, other
-找个女朋友
+反馈问题和需求
-我的情况:1993-11-03,软件工程师,广发银行编制,宅,LOLm,NS,看书,写文章,KTV,爬山,逛街
- 我的性格:ISFP(探险家 内向 实际 感性 随性)
- 希望对方:广东省,与家人关系好,爱笑甜美大眼睛
- 有兴趣请联系 1498425439@qq.com,也欢迎反馈问题和需求
+ GitHub issues
+ 微信 LinWanCen
+ 邮箱 1498425439@qq.com
@@ -141,6 +140,10 @@ Show doc comment in the Project view Tree, line End, json, other
org.jetbrains.plugins.yaml
+
+
+
+
diff --git a/src/test/java/io/github/linwancen/plugin/show/demo/ext/mybatis/demo/resources/DemoMapper.xml b/src/test/java/io/github/linwancen/plugin/show/demo/ext/mybatis/demo/resources/DemoMapper.xml
new file mode 100644
index 0000000..f3ba1d4
--- /dev/null
+++ b/src/test/java/io/github/linwancen/plugin/show/demo/ext/mybatis/demo/resources/DemoMapper.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ select injected_sql_column
+ from injected_sql_table
+
+
+ select ext_doc_column
+ from ext_doc_table
+
+
diff --git a/src/test/java/io/github/linwancen/plugin/show/demo/ext/mybatis/info/resources/column-show-comment-mybatis.xml.doc.tsv b/src/test/java/io/github/linwancen/plugin/show/demo/ext/mybatis/info/resources/column-show-comment-mybatis.xml.doc.tsv
new file mode 100644
index 0000000..3b37e35
--- /dev/null
+++ b/src/test/java/io/github/linwancen/plugin/show/demo/ext/mybatis/info/resources/column-show-comment-mybatis.xml.doc.tsv
@@ -0,0 +1 @@
+ext_doc_column 外部注释列 √ ext_doc_table ext_doc_db
\ No newline at end of file
diff --git a/src/test/java/io/github/linwancen/plugin/show/demo/ext/mybatis/info/resources/show-comment-mybatis-xml-mysql.sql b/src/test/java/io/github/linwancen/plugin/show/demo/ext/mybatis/info/resources/show-comment-mybatis-xml-mysql.sql
new file mode 100644
index 0000000..f2d8471
--- /dev/null
+++ b/src/test/java/io/github/linwancen/plugin/show/demo/ext/mybatis/info/resources/show-comment-mybatis-xml-mysql.sql
@@ -0,0 +1,31 @@
+-- table-show-comment-mybatis.xml.doc.tsv
+SELECT t.TABLE_NAME
+ , CONCAT(
+ REPLACE(REPLACE(t.TABLE_COMMENT, CHAR(10), ' '), CHAR(13), ' '), ' - ',
+ ROUND(TABLE_ROWS / 10000, 0), 'w - ',
+ GROUP_CONCAT(COLUMN_NAMES SEPARATOR ' | ')) AS INFO
+ , t.TABLE_SCHEMA
+FROM (SELECT c.TABLE_SCHEMA,
+ c.TABLE_NAME,
+ c.INDEX_NAME,
+ CONCAT(GROUP_CONCAT(c.COLUMN_NAME),
+ CASE MAX(c.NON_UNIQUE) WHEN 0 THEN ' U' ELSE '' END) AS COLUMN_NAMES
+ FROM information_schema.STATISTICS c
+ WHERE c.TABLE_SCHEMA NOT IN ('mysql', 'information_schema', 'performance_schema', 'sys')
+ GROUP BY c.TABLE_SCHEMA, c.TABLE_NAME, c.INDEX_NAME) c
+ JOIN information_schema.`TABLES` t ON t.TABLE_SCHEMA = c.TABLE_SCHEMA AND t.TABLE_NAME = c.TABLE_NAME
+GROUP BY t.TABLE_SCHEMA, t.TABLE_NAME, t.TABLE_COMMENT, TABLE_ROWS;
+
+-- column-show-comment-mybatis.xml.doc.tsv
+SELECT c.COLUMN_NAME,
+ CONCAT(REPLACE(REPLACE(c.COLUMN_COMMENT, CHAR(10), ' '), CHAR(13), ' '),
+ CASE COUNT(s.INDEX_NAME) WHEN 0 THEN '' ELSE ' √' END) AS INFO,
+ c.TABLE_NAME,
+ c.TABLE_SCHEMA
+FROM information_schema.`COLUMNS` c
+ JOIN information_schema.`TABLES` t ON t.TABLE_SCHEMA = c.TABLE_SCHEMA AND t.TABLE_NAME = c.TABLE_NAME
+ LEFT JOIN information_schema.`STATISTICS` s
+ ON s.TABLE_SCHEMA = c.TABLE_SCHEMA AND s.TABLE_NAME = c.TABLE_NAME AND s.COLUMN_NAME = c.COLUMN_NAME
+WHERE c.COLUMN_COMMENT != ''
+ AND c.TABLE_SCHEMA NOT IN ('mysql', 'information_schema', 'performance_schema', 'sys')
+GROUP BY c.COLUMN_NAME, c.COLUMN_COMMENT, c.TABLE_NAME, c.TABLE_SCHEMA;
\ No newline at end of file
diff --git a/src/test/java/io/github/linwancen/plugin/show/demo/ext/mybatis/info/resources/show-comment-mybatis.xml.key.regexp b/src/test/java/io/github/linwancen/plugin/show/demo/ext/mybatis/info/resources/show-comment-mybatis.xml.key.regexp
new file mode 100644
index 0000000..9d85a70
--- /dev/null
+++ b/src/test/java/io/github/linwancen/plugin/show/demo/ext/mybatis/info/resources/show-comment-mybatis.xml.key.regexp
@@ -0,0 +1,6 @@
+,
+<.+=
+ ?[!=].*>
+[<=>/"\s()]
+#\{[^}]++}
+\w++\.
\ No newline at end of file
diff --git a/src/test/java/io/github/linwancen/plugin/show/demo/ext/mybatis/info/resources/table-show-comment-mybatis.xml.doc.tsv b/src/test/java/io/github/linwancen/plugin/show/demo/ext/mybatis/info/resources/table-show-comment-mybatis.xml.doc.tsv
new file mode 100644
index 0000000..0b5792e
--- /dev/null
+++ b/src/test/java/io/github/linwancen/plugin/show/demo/ext/mybatis/info/resources/table-show-comment-mybatis.xml.doc.tsv
@@ -0,0 +1 @@
+ext_doc_table 表名 - 1w - id U ext_doc_db
\ No newline at end of file