From 2e5a1955f12196e77f804eb51c764c768db669a1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9E=97=E4=B8=87=E7=A8=8B?= <1498425439@qq.com>
Date: Sun, 23 Oct 2022 15:21:30 +0800
Subject: [PATCH] =?UTF-8?q?1.24=20=20Add=20PopupMenu=20Copy=20FileName:Lin?=
=?UTF-8?q?eNumber=20|=20=E5=A2=9E=E5=8A=A0=20=E5=8F=B3=E9=94=AE=E8=8F=9C?=
=?UTF-8?q?=E5=8D=95=20=E5=A4=8D=E5=88=B6=20=E6=96=87=E4=BB=B6=E5=90=8D:?=
=?UTF-8?q?=E8=A1=8C=E5=8F=B7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 44 ++++++++++++++++---
build.gradle | 4 +-
.../plugin/show/CopyReferenceSimple.java | 16 ++++++-
src/main/resources/META-INF/plugin.xml | 17 ++++---
4 files changed, 66 insertions(+), 15 deletions(-)
diff --git a/README.md b/README.md
index cb75369..9133a18 100644
--- a/README.md
+++ b/README.md
@@ -7,12 +7,10 @@ Thanks JetBrains Licenses for Open Source.
## Notes 说明
-
English Notes:
+Show doc comment at the Project view Tree, line End, json etc.
-- Show javadoc comments at the Project view Tree structure
-
- Show javadoc comments at the end-of-line
-
- Show javadoc comments at "xx-ClassNameOrSimpleName.json" and jump to field
-
- Show comments from External Conf for folder, resources, COBOL etc.
+
- "xx-ClassNameOrSimpleName.json" and jump to field
+
- from External Conf for folder, resources, COBOL etc.
- Config: settings -> Tools -> // Show Comment Global/Project
@@ -41,6 +39,7 @@ Thanks JetBrains Licenses for Open Source.
外部注释:
示例(Gitee)
+:比如你要给 .go 的文件配置文件注释可以放在相同目录或父目录的 xxx.go.tree.tsv 中
- 重新加载:工具 -> "🔄 // Reload External Comment"
- path/[any][filename.]ext.tree.tsv // 文件(夹)注释 📝 📁
@@ -52,12 +51,17 @@ Thanks JetBrains Licenses for Open Source.
- tsv 配置文件必须能被搜索(Ctrl + Shift + N)
+如果对你有所帮助,别忘了给本项目
+GitHub
+主页一个 Start,您的支持是项目前进的动力。
+
## Change Notes 更新说明
English Change Notes:
+- 1.24 Add PopupMenu Copy FileName:LineNumber
- 1.23 Add project-view-tree-comment setting for show when compact middle packages
- 1.22 Add PopupMenu Copy ClassName.MethodName
- 1.21 Add line-end-comment default skip only English when system lang is not `en`
@@ -85,6 +89,7 @@ Thanks JetBrains Licenses for Open Source.
中文更新说明:
+- 1.24 增加 右键菜单 复制 文件名:行号
- 1.23 增加 项目导航栏注释 折叠中间包时显示中间包注释设置
- 1.22 增加 右键菜单 复制 类名.方法名
- 1.21 增加 行末注释 系统语言非英文时 默认 忽略纯英文
@@ -119,4 +124,31 @@ See in IDEA with this plugin | 安装插件后用 IDEA 查看
- [Java Doc Comment Demo | Java 文档注释](src/test/java/io/github/linwancen/plugin/show/demo/java/Call.java)
- [JSON Doc Comment Demo | JSON 文档注释](src/test/java/io/github/linwancen/plugin/show/demo/json/base-Pojo.json)
- [External Comment Demo For COBOL | 外部注释 Demo](src/test/java/io/github/linwancen/plugin/show/demo/ext/cobol/demo/BASE.cbl)
-- [COBOL Highlighting | COBOL 高亮配置](src/test/java/io/github/linwancen/plugin/show/demo/ext/cobol/cobol/COBOL_IDEA.md)
\ No newline at end of file
+- [COBOL Highlighting | COBOL 高亮配置](src/test/java/io/github/linwancen/plugin/show/demo/ext/cobol/cobol/COBOL_IDEA.md)
+
+
+#### Maven down source jar 自动下载带注释的源码
+```xml
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+ 3.1.2
+
+
+ down_source_jar
+ validate
+
+ sources
+
+
+
+
+ com.company.common.base,
+
+ com.company.common.errcode
+
+
+
+
+
+```
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index c6f994c..cd9c1c8 100644
--- a/build.gradle
+++ b/build.gradle
@@ -4,7 +4,7 @@ plugins {
}
group 'io.github.linwancen'
-version '1.23.0.' + (new Date().format('yyyy.MM.dd_HH.mm'))
+version '1.24.0.' + (new Date().format('yyyy.MM.dd_HH.mm'))
apply plugin: 'java'
@@ -39,6 +39,7 @@ patchPluginXml {
changeNotes = """
English Change Notes:
+- 1.24 Add PopupMenu Copy FileName:LineNumber
- 1.23 Add project-view-tree-comment setting for show when compact middle packages
- 1.22 Add PopupMenu Copy ClassName.MethodName
- 1.21 Add line-end-comment default skip only English when system lang is not `en`
@@ -66,6 +67,7 @@ patchPluginXml {
中文更新说明:
+- 1.24 增加 右键菜单 复制 文件名:行号
- 1.23 增加 项目导航栏注释 折叠中间包时显示中间包注释设置
- 1.22 增加 右键菜单 复制 类名.方法名
- 1.21 增加 行末注释 系统语言非英文时 默认 忽略纯英文
diff --git a/src/main/java/io/github/linwancen/plugin/show/CopyReferenceSimple.java b/src/main/java/io/github/linwancen/plugin/show/CopyReferenceSimple.java
index ec86a59..e5a0bfc 100644
--- a/src/main/java/io/github/linwancen/plugin/show/CopyReferenceSimple.java
+++ b/src/main/java/io/github/linwancen/plugin/show/CopyReferenceSimple.java
@@ -3,8 +3,12 @@ package io.github.linwancen.plugin.show;
import com.intellij.ide.IdeBundle;
import com.intellij.ide.actions.CopyReferenceAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
+import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiFile;
import org.jetbrains.annotations.NotNull;
import java.util.List;
@@ -17,7 +21,7 @@ public class CopyReferenceSimple extends CopyReferenceAction {
super.update(e);
String tip = IdeBundle.message("copy.reference");
if (tip != null && tip.replace("\u001B", "").equals(e.getPresentation().getText())) {
- e.getPresentation().setText("Copy ClassName.MethodName");
+ e.getPresentation().setText("Copy Class.Method/File:Line");
}
}
@@ -27,6 +31,16 @@ public class CopyReferenceSimple extends CopyReferenceAction {
protected String getQualifiedName(Editor editor, List elements) {
String qualifiedName = super.getQualifiedName(editor, elements);
if (qualifiedName == null) {
+ Document document = editor.getDocument();
+ Project project = editor.getProject();
+ if (project == null) {
+ return null;
+ }
+ PsiFile file = PsiDocumentManager.getInstance(project).getCachedPsiFile(document);
+ if (file != null) {
+ // getFileFqn(file) => file.getName()
+ return file.getName() + ":" + (editor.getCaretModel().getLogicalPosition().line + 1);
+ }
return null;
}
int i = qualifiedName.indexOf("(");
diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml
index 82dcada..4fb7d6e 100644
--- a/src/main/resources/META-INF/plugin.xml
+++ b/src/main/resources/META-INF/plugin.xml
@@ -1,15 +1,13 @@
-
+
io.github.linwancen.show-comment
Show Comment
林万程
English Notes:
+Show doc comment at the Project view Tree, line End, json etc.
-- Show javadoc comments at the Project view Tree structure
-
- Show javadoc comments at the end-of-line
-
- Show javadoc comments at "xx-ClassNameOrSimpleName.json" and jump to field
-
- Show comments from External Conf for folder, resources, COBOL etc.
+
- "xx-ClassNameOrSimpleName.json" and jump to field
+
- from External Conf for folder, resources, COBOL etc.
- Config: settings -> Tools -> // Show Comment Global/Project
@@ -38,6 +36,7 @@
外部注释:
示例(Gitee)
+:比如你要给 .go 的文件配置文件注释可以放在相同目录或父目录的 xxx.go.tree.tsv 中
- 重新加载:工具 -> "🔄 // Reload External Comment"
- path/[any][filename.]ext.tree.tsv // 文件(夹)注释 📝 📁
@@ -48,6 +47,10 @@
- 在搜索弹出窗中修改 tsv 文件将不会被重加载
- tsv 配置文件必须能被搜索(Ctrl + Shift + N)
+
+如果对你有所帮助,别忘了给本项目
+GitHub
+主页一个 Start,您的支持是项目前进的动力。
]]>