From e26ff72da8475699e395bc6481e574e3d177d367 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9E=97=E4=B8=87=E7=A8=8B?= <1498425439@qq.com>
Date: Thu, 28 Apr 2022 00:47:45 +0800
Subject: [PATCH] =?UTF-8?q?1.15=20support=20COBOL=20ext=20'',=20'cbl',=20'?=
=?UTF-8?q?cob',=20'cobol'=20|=20COBOL=20=E6=8B=93=E5=B1=95=E5=90=8D?=
=?UTF-8?q?=E6=94=AF=E6=8C=81=20=E6=97=A0=E6=8B=93=E5=B1=95=E5=90=8D?=
=?UTF-8?q?=E3=80=81cbl=E3=80=81cob=E3=80=81cobol?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 2 ++
build.gradle | 4 +++-
.../java/io/github/linwancen/plugin/show/ext/LineExt.java | 4 ++--
.../linwancen/plugin/show/ext/conf/ConfCacheGetUtils.java | 5 ++++-
4 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index 60a98bf..9c3b037 100644
--- a/README.md
+++ b/README.md
@@ -56,6 +56,7 @@ https://plugins.jetbrains.com/plugin/18553-show-comment
English Change Notes:
+- 1.15 Add line-end-comment support COBOL ext '', 'cbl', 'cob', 'cobol'
- 1.14 Add line-end-comment skip Annotation, skip only English (ASCII)
- 1.13 Add Copy With Line Comment & Add Line Comment
- 1.12 ★ External Comment for COBOL etc
@@ -74,6 +75,7 @@ https://plugins.jetbrains.com/plugin/18553-show-comment
中文更新说明:
+- 1.15 增加 行末注释 COBOL 拓展名支持 无拓展名、cbl、cob、cobol
- 1.14 增加 行末注释 忽略注解 与 忽略纯英文
- 1.13 增加 带行末注释复制 和 添加行末注释
- 1.12 ★ 外部注释用于 COBOL 等
diff --git a/build.gradle b/build.gradle
index 1477edf..dc32239 100644
--- a/build.gradle
+++ b/build.gradle
@@ -4,7 +4,7 @@ plugins {
}
group 'io.github.linwancen'
-version '1.14.0.' + (new Date().format('yyyy.MM.dd_HH.mm'))
+version '1.15.0.' + (new Date().format('yyyy.MM.dd_HH.mm'))
apply plugin: 'java'
@@ -39,6 +39,7 @@ patchPluginXml {
changeNotes = """
English Change Notes:
+- 1.15 Add line-end-comment support COBOL ext '', 'cbl', 'cob', 'cobol'
- 1.14 Add line-end-comment skip Annotation, skip only English (ASCII)
- 1.13 Add Copy With Line Comment & Add Line Comment
- 1.12 ★ External Comment for COBOL etc
@@ -57,6 +58,7 @@ patchPluginXml {
中文更新说明:
+- 1.15 增加 行末注释 COBOL 拓展名支持 无拓展名、cbl、cob、cobol
- 1.14 增加 行末注释 忽略注解 与 忽略纯英文
- 1.13 增加 带行末注释复制 和 添加行末注释
- 1.12 ★ 外部注释用于 COBOL 等
diff --git a/src/main/java/io/github/linwancen/plugin/show/ext/LineExt.java b/src/main/java/io/github/linwancen/plugin/show/ext/LineExt.java
index a5305a3..40e1f14 100644
--- a/src/main/java/io/github/linwancen/plugin/show/ext/LineExt.java
+++ b/src/main/java/io/github/linwancen/plugin/show/ext/LineExt.java
@@ -30,7 +30,7 @@ public class LineExt {
return null;
}
Map>> treeMap = ConfCache.treeMap(path);
- if ("cbl".equals(ext)) {
+ if (ext == null || "cbl".equals(ext) || "cob".equals(ext) || "cobol".equals(ext)) {
text = cblNotAndOr(text);
}
String[] words = pattern.split(text);
@@ -53,7 +53,7 @@ public class LineExt {
}
String key = matcher.group(1);
// put NOT first
- text = matcher.replaceAll("$2 ( $1 = '");
+ text = matcher.replaceAll(" $2 ( $1 = '");
// add key after AND/OR
return AND_OR_PATTERN.matcher(text).replaceAll("$1 " + key + " = '");
}
diff --git a/src/main/java/io/github/linwancen/plugin/show/ext/conf/ConfCacheGetUtils.java b/src/main/java/io/github/linwancen/plugin/show/ext/conf/ConfCacheGetUtils.java
index f0e15fe..4ddbba2 100644
--- a/src/main/java/io/github/linwancen/plugin/show/ext/conf/ConfCacheGetUtils.java
+++ b/src/main/java/io/github/linwancen/plugin/show/ext/conf/ConfCacheGetUtils.java
@@ -48,7 +48,10 @@ class ConfCacheGetUtils {
map.put(levelStr + "\b" + confPath, entry.getValue());
} else if (confName.endsWith((name + confMidExt))) {
map.put(levelStr + "\t" + confPath, entry.getValue());
- } else if (ext != null) {
+ } else{
+ if (ext == null) {
+ ext = "";
+ }
if ((ext + confMidExt).equals(confName)) {
map.put(levelStr + "\n" + confPath, entry.getValue());
} else if (confName.endsWith((ext + confMidExt))) {