diff --git a/build.gradle b/build.gradle
index 4adfe03..337bc57 100644
--- a/build.gradle
+++ b/build.gradle
@@ -4,7 +4,7 @@ plugins {
}
group 'io.github.linwancen'
-version '2.23.0.' + (new Date().format('yyyy.MM.dd_HH.mm'))
+version '2.24.0.' + (new Date().format('yyyy.MM.dd_HH.mm'))
patchPluginXml {
// The performance of 2019.3 has been greatly improved.
@@ -15,6 +15,7 @@ patchPluginXml {
changeNotes = """
English Change Notes:
+- 2.24 Add line-end-comment Maven pom.xml \${} doc
- 2.23 Add line-end-comment kotlin anno doc
- 2.22 Add project-view-tree ollama models blobs comment from manifests
- 2.21 Add project-view-tree use JS/TS/Vue "export default" doc for tree doc
@@ -67,6 +68,7 @@ patchPluginXml {
中文更新说明:
+- 2.24 增加 行末注释 Maven pom.xml \${} 注释
- 2.23 增加 行末注释 kotlin 注解注释
- 2.22 增加 文件树注释 ollama models 文件夹从 manifests 获取 blobs 文件注释
- 2.21 增加 文件树注释 用 JS/TS/Vue "export default" 注释当文件注释
@@ -151,6 +153,7 @@ intellij {
]
if ('IC' == ideTypeStr || 'IU' == ideTypeStr) {
plugins.add('java')
+ plugins.add('org.jetbrains.idea.maven')
plugins.add('org.jetbrains.kotlin')
plugins.add('org.intellij.groovy')
plugins.add('org.intellij.scala:2020.1.43')
diff --git a/src/main/idea/io/github/linwancen/plugin/show/java/MavenLangDoc.java b/src/main/idea/io/github/linwancen/plugin/show/java/MavenLangDoc.java
new file mode 100644
index 0000000..99838d6
--- /dev/null
+++ b/src/main/idea/io/github/linwancen/plugin/show/java/MavenLangDoc.java
@@ -0,0 +1,49 @@
+package io.github.linwancen.plugin.show.java;
+
+import com.intellij.psi.FileViewProvider;
+import com.intellij.psi.PsiElement;
+import io.github.linwancen.plugin.show.bean.LineInfo;
+import io.github.linwancen.plugin.show.lang.XmlLangDoc;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.maven.dom.MavenDomUtil;
+import org.jetbrains.idea.maven.dom.MavenPropertyResolver;
+import org.jetbrains.idea.maven.dom.model.MavenDomProjectModel;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class MavenLangDoc extends XmlLangDoc {
+ Pattern PARAM_PATTERN = Pattern.compile("\\$\\{[^}]++}");
+
+ @Nullable
+ @Override
+ public String findRefDoc(@NotNull LineInfo info, @NotNull FileViewProvider viewProvider,
+ @NotNull PsiElement element) {
+ if (!"pom.xml".equals(info.file.getName()) || !info.text.contains("$")) {
+ return null;
+ }
+ MavenDomProjectModel mdm = MavenDomUtil.getMavenDomModel(element.getContainingFile(), MavenDomProjectModel.class);
+ if (mdm == null) {
+ return null;
+ }
+ List list = new ArrayList<>();
+ Matcher m = PARAM_PATTERN.matcher(info.text);
+ while (m.find()) {
+ String s = m.group();
+ String v;
+ try {
+ v = MavenPropertyResolver.resolve(s, mdm);
+ } catch (Exception ignored) {
+ v = "";
+ }
+ list.add(v);
+ }
+ if (list.isEmpty()) {
+ return null;
+ }
+ return String.join(" | ", list);
+ }
+}
diff --git a/src/main/java/io/github/linwancen/plugin/show/lang/XmlLangDoc.java b/src/main/java/io/github/linwancen/plugin/show/lang/XmlLangDoc.java
new file mode 100644
index 0000000..a23336c
--- /dev/null
+++ b/src/main/java/io/github/linwancen/plugin/show/lang/XmlLangDoc.java
@@ -0,0 +1,45 @@
+package io.github.linwancen.plugin.show.lang;
+
+import com.intellij.lang.xml.XMLLanguage;
+import com.intellij.openapi.extensions.ExtensionPointName;
+import com.intellij.psi.FileViewProvider;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.xml.XmlAttribute;
+import com.intellij.psi.xml.XmlTag;
+import io.github.linwancen.plugin.show.bean.LineInfo;
+import io.github.linwancen.plugin.show.lang.base.BaseLangDoc;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.List;
+
+public class XmlLangDoc extends BaseLangDoc {
+
+ static {
+ LANG_DOC_MAP.put(XMLLanguage.INSTANCE.getID(), new XmlLangDoc());
+ }
+
+ @Override
+ public @NotNull List> getRefClass() {
+ return List.of(XmlAttribute.class, XmlTag.class);
+ }
+
+ @Override
+ public boolean show(@NotNull LineInfo info) {
+ return true;
+ }
+
+ @Nullable
+ @Override
+ public String findRefDoc(@NotNull LineInfo info, @NotNull FileViewProvider viewProvider, @NotNull PsiElement element) {
+ ExtensionPointName epn = ExtensionPointName.create("io.github.linwancen.show-comment.xmlLangDoc");
+ List extensionList = epn.getExtensionList();
+ for (XmlLangDoc xmlLangDoc : extensionList) {
+ String doc = xmlLangDoc.findRefDoc(info, viewProvider, element);
+ if (doc != null && !doc.trim().isEmpty()) {
+ return doc;
+ }
+ }
+ return null;
+ }
+}
diff --git a/src/main/java/io/github/linwancen/plugin/show/settings/AbstractSettingsComponent.java b/src/main/java/io/github/linwancen/plugin/show/settings/AbstractSettingsComponent.java
index c88450c..fbc1225 100644
--- a/src/main/java/io/github/linwancen/plugin/show/settings/AbstractSettingsComponent.java
+++ b/src/main/java/io/github/linwancen/plugin/show/settings/AbstractSettingsComponent.java
@@ -42,6 +42,7 @@ public abstract class AbstractSettingsComponent {
protected JPanel commonPanel() {
return FormBuilder.createFormBuilder()
.addComponent(lineEndPanel(), 1)
+ .addComponent(webPanel(), 1)
.addComponent(treePanel(), 1)
.getPanel();
}
@@ -58,11 +59,6 @@ public abstract class AbstractSettingsComponent {
.addSeparator()
.addLabeledComponent(new JBLabel(ShowBundle.message("comment.include.regexp")), docInclude, 1, true)
.addLabeledComponent(new JBLabel(ShowBundle.message("comment.exclude.regexp")), docExclude, 1, true)
- .addSeparator()
- .addLabeledComponent(new JBLabel(ShowBundle.message("tag.include.regexp")), tagInclude, 1, true)
- .addLabeledComponent(new JBLabel(ShowBundle.message("tag.exclude.regexp")), tagExclude, 1, true)
- .addLabeledComponent(new JBLabel(ShowBundle.message("attr.include.regexp")), attrInclude, 1, true)
- .addLabeledComponent(new JBLabel(ShowBundle.message("attr.exclude.regexp")), attrExclude, 1, true)
.addSeparator();
Border border = docGet.getBorder();
annoDoc.setBorder(border);
@@ -77,6 +73,18 @@ public abstract class AbstractSettingsComponent {
return panel;
}
+ @NotNull
+ private JPanel webPanel() {
+ JPanel panel = FormBuilder.createFormBuilder()
+ .addLabeledComponent(new JBLabel(ShowBundle.message("tag.include.regexp")), tagInclude, 1, true)
+ .addLabeledComponent(new JBLabel(ShowBundle.message("tag.exclude.regexp")), tagExclude, 1, true)
+ .addLabeledComponent(new JBLabel(ShowBundle.message("attr.include.regexp")), attrInclude, 1, true)
+ .addLabeledComponent(new JBLabel(ShowBundle.message("attr.exclude.regexp")), attrExclude, 1, true)
+ .getPanel();
+ panel.setBorder(IdeBorderFactory.createTitledBorder(ShowBundle.message("web.comment")));
+ return panel;
+ }
+
@NotNull
private JPanel treePanel() {
@NotNull JPanel dirLabel = JPanelFactory.of(dirDocEffect, new JBLabel(ShowBundle.message("dir.doc.regexp")));
diff --git a/src/main/resources/META-INF/java.xml b/src/main/resources/META-INF/java.xml
index 34293ac..692a6a5 100644
--- a/src/main/resources/META-INF/java.xml
+++ b/src/main/resources/META-INF/java.xml
@@ -1,6 +1,7 @@
-
+
+
\ No newline at end of file
diff --git a/src/main/resources/META-INF/maven.xml b/src/main/resources/META-INF/maven.xml
new file mode 100644
index 0000000..9cdfcf2
--- /dev/null
+++ b/src/main/resources/META-INF/maven.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml
index b9a5c87..fe4b962 100644
--- a/src/main/resources/META-INF/plugin.xml
+++ b/src/main/resources/META-INF/plugin.xml
@@ -123,6 +123,7 @@ Show doc comment in the Project view Tree, line End, json, other
on how to target different products -->
com.intellij.modules.platform
com.intellij.modules.java
+ org.jetbrains.idea.maven
org.jetbrains.kotlin
org.intellij.groovy
org.intellij.scala
@@ -163,6 +164,7 @@ Show doc comment in the Project view Tree, line End, json, other
+
@@ -172,6 +174,7 @@ Show doc comment in the Project view Tree, line End, json, other
+
diff --git a/src/main/resources/messages/ShowCommentBundle.properties b/src/main/resources/messages/ShowCommentBundle.properties
index 74ae826..6a43614 100644
--- a/src/main/resources/messages/ShowCommentBundle.properties
+++ b/src/main/resources/messages/ShowCommentBundle.properties
@@ -23,6 +23,7 @@ text.color.json=json text color:
prefix=prefix:
line.end.comment=Line End Comment
+web.comment=Web Comment
tree.comment=Tree Comment
regexp.tip=Separated by '|' (Regexp), use '' to include all or exclude none.
sign.include.regexp=className#memberName include Regexp:
diff --git a/src/main/resources/messages/ShowCommentBundle_zh.properties b/src/main/resources/messages/ShowCommentBundle_zh.properties
index 91fe159..bbeebed 100644
--- a/src/main/resources/messages/ShowCommentBundle_zh.properties
+++ b/src/main/resources/messages/ShowCommentBundle_zh.properties
@@ -23,6 +23,7 @@ text.color.json=json \u6587\u672C\u989C\u8272\uFF1A
prefix=\u524D\u7F00\uFF1A
line.end.comment=\u884C\u672B\u6CE8\u91CA
+web.comment=Web \u6CE8\u91CA
tree.comment=\u6811\u6CE8\u91CA
regexp.tip=| \u5206\u9694 (\u6B63\u5219), \u7A7A\u5B57\u7B26\u4E32\u4EE3\u8868\u5305\u62EC\u6240\u6709\u6216\u4E0D\u6392\u9664
sign.include.regexp=\u7C7B#\u65B9\u6CD5 \u5305\u542B \u6B63\u5219\uFF1A