feat: 2.17 support *.key.regexp and MyBatis xml demo in Git | 支持 *.key.regexp 与 Mybatis xml 示例在 Git
This commit is contained in:
19
README.md
19
README.md
@@ -34,10 +34,10 @@ Show doc comment in the Project view Tree, line End, json, other
|
||||
<ul>
|
||||
<li>Reload: Tools -> 🔄 // Reload External Comment
|
||||
<li>path/[any][filename.]ext.tree.tsv // file and folder tree comment 📝 📁
|
||||
<li>path/[any][filename.]ext.key.tsv // line keywords to split and comment
|
||||
<li>path/[any][filename.]ext.key.regexp // line keywords to split and comment
|
||||
<li>path/[any][filename.]ext.doc.tsv // line words comment
|
||||
<li>In path, "doc" can replace any, and can use % like in SQL, effect at previous layer when folder named -1
|
||||
<li>The lines in key.tsv will be concatenated with `|` to regexp; longer str should in front; startWith `?` to exclude
|
||||
<li>The lines in key.regexp will be concatenated with `|` to regexp; longer str should in front; startWith `?` to exclude
|
||||
<li>Chang tsv file in find pop window would not reload!
|
||||
<li>The tsv conf file must could be search in "Go to File" (Ctrl + Shift + N)
|
||||
</ul>
|
||||
@@ -78,9 +78,9 @@ Show doc comment in the Project view Tree, line End, json, other
|
||||
<ul>
|
||||
<li>重新加载:工具 -> "🔄 // Reload External Comment"
|
||||
<li>path/[any][filename.]ext.tree.tsv // 文件(夹)注释 📝 📁
|
||||
<li>path/[any][filename.]ext.key.tsv // 切割关键字与注释
|
||||
<li>path/[any][filename.]ext.key.regexp // 切割关键字与注释
|
||||
<li>path/[any][filename.]ext.doc.tsv // 词注释
|
||||
<li>key.tsv 的每一行将会用`|`连接起来形成正则表达式,较长的关键字应该放在前面,用 `?` 开头排除
|
||||
<li>key.regexp 的每一行将会用`|`连接起来形成正则表达式,较长的关键字应该放在前面,用 `?` 开头排除
|
||||
<li>doc 文件夹可以替换任何一层文件夹,可以像 SQL 那样用 % 模糊匹配,文件夹名为 -1 时在上一层文件夹生效
|
||||
<li>在搜索弹出窗中修改 tsv 文件将不会被重加载
|
||||
<li>tsv 配置文件必须能被搜索(Ctrl + Shift + N)
|
||||
@@ -104,12 +104,11 @@ Show doc comment in the Project view Tree, line End, json, other
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
<h4>找个女朋友</h4>
|
||||
<h4>反馈问题和需求</h4>
|
||||
<ul>
|
||||
<li>我的情况:1993-11-03,软件工程师,广发银行编制,宅,LOLm,NS,看书,写文章,KTV,爬山,逛街
|
||||
<li>我的性格:ISFP(探险家 内向 实际 感性 随性)
|
||||
<li>希望对方:广东省,与家人关系好,爱笑甜美大眼睛
|
||||
<li>有兴趣请联系 1498425439@qq.com,也欢迎反馈问题和需求
|
||||
<a href="https://github.com/LinWanCen/show-comment/issue">GitHub issues</a>
|
||||
<li>微信 LinWanCen
|
||||
<li>邮箱 1498425439@qq.com
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
@@ -126,6 +125,7 @@ Show doc comment in the Project view Tree, line End, json, other
|
||||
|
||||
<h2>English Change Notes:</h2>
|
||||
<ul>
|
||||
<li>2.17 Add External Comment support *.key.regexp and MyBatis xml demo in Git
|
||||
<li>2.16 Add line-end-comment support Rust, Ruby, PHP, C/C++/Object C, Scala, Groovy
|
||||
<li>2.15 Add line-end-comment java anno doc
|
||||
<li>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
|
||||
|
||||
<h2>中文更新说明:</h2>
|
||||
<ul>
|
||||
<li>2.17 增加 tsv 注释 支持 *.key.regexp 与 Mybatis xml 示例在 Git
|
||||
<li>2.16 增加 行末注释 支持 Rust, Ruby, PHP, C/C++/Object C, Scala, Groovy
|
||||
<li>2.15 增加 行末注释 java 注解注释
|
||||
<li>2.14 增加 行末注释 java 枚举注释用于 Yes(1, "是")
|
||||
|
||||
@@ -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 = """
|
||||
<h2>English Change Notes:</h2>
|
||||
<ul>
|
||||
<li>2.17 Add External Comment support *.key.regexp and MyBatis xml demo in Git
|
||||
<li>2.16 Add line-end-comment support Rust, Ruby, PHP, C/C++/Object C, Scala, Groovy
|
||||
<li>2.15 Add line-end-comment java anno doc
|
||||
<li>2.14 Add line-end-comment java enum doc for Yes(1, "Yes")
|
||||
@@ -140,6 +141,7 @@ patchPluginXml {
|
||||
|
||||
<h2>中文更新说明:</h2>
|
||||
<ul>
|
||||
<li>2.17 增加 tsv 注释 支持 *.key.regexp 与 Mybatis xml 示例在 Git
|
||||
<li>2.16 增加 行末注释 支持 Rust, Ruby, PHP, C/C++/Object C, Scala, Groovy
|
||||
<li>2.15 增加 行末注释 java 注解注释
|
||||
<li>2.14 增加 行末注释 java 枚举注释用于 Yes(1, "是")
|
||||
|
||||
@@ -132,6 +132,12 @@ public class ConfCache {
|
||||
load(file);
|
||||
sb.append(file.getName()).append("\n");
|
||||
}
|
||||
@NotNull Collection<VirtualFile> 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());
|
||||
|
||||
@@ -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("\\(\\?[^)]++\\)");
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -32,10 +32,10 @@ Show doc comment in the Project view Tree, line End, json, other
|
||||
<ul>
|
||||
<li>Reload: Tools -> 🔄 // Reload External Comment
|
||||
<li>path/[any][filename.]ext.tree.tsv // file and folder tree comment 📝 📁
|
||||
<li>path/[any][filename.]ext.key.tsv // line keywords to split and comment
|
||||
<li>path/[any][filename.]ext.key.regexp // line keywords to split and comment
|
||||
<li>path/[any][filename.]ext.doc.tsv // line words comment
|
||||
<li>In path, "doc" can replace any, and can use % like in SQL, effect at previous layer when folder named -1
|
||||
<li>The lines in key.tsv will be concatenated with `|` to regexp; longer str should in front; startWith `?` to exclude
|
||||
<li>The lines in key.regexp will be concatenated with `|` to regexp; longer str should in front; startWith `?` to exclude
|
||||
<li>Chang tsv file in find pop window would not reload!
|
||||
<li>The tsv conf file must could be search in "Go to File" (Ctrl + Shift + N)
|
||||
</ul>
|
||||
@@ -76,9 +76,9 @@ Show doc comment in the Project view Tree, line End, json, other
|
||||
<ul>
|
||||
<li>重新加载:工具 -> "🔄 // Reload External Comment"
|
||||
<li>path/[any][filename.]ext.tree.tsv // 文件(夹)注释 📝 📁
|
||||
<li>path/[any][filename.]ext.key.tsv // 切割关键字与注释
|
||||
<li>path/[any][filename.]ext.key.regexp // 切割关键字与注释
|
||||
<li>path/[any][filename.]ext.doc.tsv // 词注释
|
||||
<li>key.tsv 的每一行将会用`|`连接起来形成正则表达式,较长的关键字应该放在前面,用 `?` 开头排除
|
||||
<li>key.regexp 的每一行将会用`|`连接起来形成正则表达式,较长的关键字应该放在前面,用 `?` 开头排除
|
||||
<li>doc 文件夹可以替换任何一层文件夹,可以像 SQL 那样用 % 模糊匹配,文件夹名为 -1 时在上一层文件夹生效
|
||||
<li>在搜索弹出窗中修改 tsv 文件将不会被重加载
|
||||
<li>tsv 配置文件必须能被搜索(Ctrl + Shift + N)
|
||||
@@ -102,12 +102,11 @@ Show doc comment in the Project view Tree, line End, json, other
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
<h4>找个女朋友</h4>
|
||||
<h4>反馈问题和需求</h4>
|
||||
<ul>
|
||||
<li>我的情况:1993-11-03,软件工程师,广发银行编制,宅,LOLm,NS,看书,写文章,KTV,爬山,逛街
|
||||
<li>我的性格:ISFP(探险家 内向 实际 感性 随性)
|
||||
<li>希望对方:广东省,与家人关系好,爱笑甜美大眼睛
|
||||
<li>有兴趣请联系 1498425439@qq.com,也欢迎反馈问题和需求
|
||||
<a href="https://github.com/LinWanCen/show-comment/issues">GitHub issues</a>
|
||||
<li>微信 LinWanCen
|
||||
<li>邮箱 1498425439@qq.com
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
@@ -141,6 +140,10 @@ Show doc comment in the Project view Tree, line End, json, other
|
||||
<depends optional="true" config-file="yaml.xml">org.jetbrains.plugins.yaml</depends>
|
||||
<!--<depends optional="true" config-file="cs.xml">com.intellij.modules.rider</depends>-->
|
||||
|
||||
<extensions defaultExtensionNs="org.jetbrains.kotlin">
|
||||
<supportsKotlinPluginMode supportsK2="true" />
|
||||
</extensions>
|
||||
|
||||
<applicationListeners>
|
||||
<listener class="io.github.linwancen.plugin.show.ext.conf.listener.ConfFileListener"
|
||||
topic="com.intellij.openapi.vfs.newvfs.BulkFileListener"/>
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="io.github.linwancen.plugin.show.mapper.DemoMapper">
|
||||
<select id="select1">
|
||||
select injected_sql_column
|
||||
from injected_sql_table
|
||||
</select>
|
||||
<select id="select2">
|
||||
select ext_doc_column
|
||||
from ext_doc_table
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1 @@
|
||||
ext_doc_column 外部注释列 √ ext_doc_table ext_doc_db
|
||||
|
@@ -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;
|
||||
@@ -0,0 +1,6 @@
|
||||
,
|
||||
<.+=
|
||||
?[!=].*>
|
||||
[<=>/"\s()]
|
||||
#\{[^}]++}
|
||||
\w++\.
|
||||
@@ -0,0 +1 @@
|
||||
ext_doc_table 表名 - 1w - id U ext_doc_db
|
||||
|
Reference in New Issue
Block a user