1.24 Add PopupMenu Copy FileName:LineNumber | 增加 右键菜单 复制 文件名:行号
This commit is contained in:
44
README.md
44
README.md
@@ -7,12 +7,10 @@ Thanks JetBrains Licenses for Open Source.
|
||||
|
||||
## Notes 说明
|
||||
|
||||
<h2>English Notes:</h2>
|
||||
Show doc comment at the Project view Tree, line End, json etc.
|
||||
<ul>
|
||||
<li>Show javadoc comments at the Project view Tree structure
|
||||
<li>Show javadoc comments at the end-of-line
|
||||
<li>Show javadoc comments at "xx-ClassNameOrSimpleName.json" and jump to field
|
||||
<li>Show comments from External Conf for folder, resources, COBOL etc.
|
||||
<li>"xx-ClassNameOrSimpleName.json" and jump to field
|
||||
<li>from External Conf for folder, resources, COBOL etc.
|
||||
<li>Config: settings -> Tools -> // Show Comment Global/Project
|
||||
</ul>
|
||||
|
||||
@@ -41,6 +39,7 @@ Thanks JetBrains Licenses for Open Source.
|
||||
|
||||
<h3>外部注释:</h3>
|
||||
<a href="https://gitee.com/LinWanCen/show-comment/tree/main/src/test/java/io/github/linwancen/plugin/show/demo/ext">示例(Gitee)</a>
|
||||
:比如你要给 .go 的文件配置文件注释可以放在相同目录或父目录的 xxx.go.tree.tsv 中
|
||||
<ul>
|
||||
<li>重新加载:工具 -> "🔄 // Reload External Comment"
|
||||
<li>path/[any][filename.]ext.tree.tsv // 文件(夹)注释 📝 📁
|
||||
@@ -52,12 +51,17 @@ Thanks JetBrains Licenses for Open Source.
|
||||
<li>tsv 配置文件必须能被搜索(Ctrl + Shift + N)
|
||||
</ul>
|
||||
|
||||
如果对你有所帮助,别忘了给本项目
|
||||
<a href="https://github.com/LinWanCen/show-comment">GitHub</a>
|
||||
主页一个 Start,您的支持是项目前进的动力。
|
||||
|
||||
|
||||
|
||||
## Change Notes 更新说明
|
||||
|
||||
<h2>English Change Notes:</h2>
|
||||
<ul>
|
||||
<li>1.24 Add PopupMenu Copy FileName:LineNumber
|
||||
<li>1.23 Add project-view-tree-comment setting for show when compact middle packages
|
||||
<li>1.22 Add PopupMenu Copy ClassName.MethodName
|
||||
<li>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.
|
||||
|
||||
<h2>中文更新说明:</h2>
|
||||
<ul>
|
||||
<li>1.24 增加 右键菜单 复制 文件名:行号
|
||||
<li>1.23 增加 项目导航栏注释 折叠中间包时显示中间包注释设置
|
||||
<li>1.22 增加 右键菜单 复制 类名.方法名
|
||||
<li>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)
|
||||
- [COBOL Highlighting | COBOL 高亮配置](src/test/java/io/github/linwancen/plugin/show/demo/ext/cobol/cobol/COBOL_IDEA.md)
|
||||
|
||||
|
||||
#### Maven down source jar 自动下载带注释的源码
|
||||
```xml
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>3.1.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>down_source_jar</id>
|
||||
<phase>validate</phase>
|
||||
<goals>
|
||||
<goal>sources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<includeArtifactIds>
|
||||
<!-- 公司统一出入参基类 -->
|
||||
com.company.common.base,
|
||||
<!-- 公司统一错误码 -->
|
||||
com.company.common.errcode
|
||||
</includeArtifactIds>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
```
|
||||
@@ -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 = """
|
||||
<h2>English Change Notes:</h2>
|
||||
<ul>
|
||||
<li>1.24 Add PopupMenu Copy FileName:LineNumber
|
||||
<li>1.23 Add project-view-tree-comment setting for show when compact middle packages
|
||||
<li>1.22 Add PopupMenu Copy ClassName.MethodName
|
||||
<li>1.21 Add line-end-comment default skip only English when system lang is not `en`
|
||||
@@ -66,6 +67,7 @@ patchPluginXml {
|
||||
|
||||
<h2>中文更新说明:</h2>
|
||||
<ul>
|
||||
<li>1.24 增加 右键菜单 复制 文件名:行号
|
||||
<li>1.23 增加 项目导航栏注释 折叠中间包时显示中间包注释设置
|
||||
<li>1.22 增加 右键菜单 复制 类名.方法名
|
||||
<li>1.21 增加 行末注释 系统语言非英文时 默认 忽略纯英文
|
||||
|
||||
@@ -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<PsiElement> 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("(");
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
<idea-plugin>
|
||||
<idea-plugin url="https://plugins.jetbrains.com/plugin/18553-show-comment">
|
||||
<id>io.github.linwancen.show-comment</id>
|
||||
<name>Show Comment</name>
|
||||
<vendor email="1498425439@qq.com" url="https://github.com/LinWanCen/show-comment">林万程</vendor>
|
||||
|
||||
<description><![CDATA[
|
||||
<h2>English Notes:</h2>
|
||||
Show doc comment at the Project view Tree, line End, json etc.
|
||||
<ul>
|
||||
<li>Show javadoc comments at the Project view Tree structure
|
||||
<li>Show javadoc comments at the end-of-line
|
||||
<li>Show javadoc comments at "xx-ClassNameOrSimpleName.json" and jump to field
|
||||
<li>Show comments from External Conf for folder, resources, COBOL etc.
|
||||
<li>"xx-ClassNameOrSimpleName.json" and jump to field
|
||||
<li>from External Conf for folder, resources, COBOL etc.
|
||||
<li>Config: settings -> Tools -> // Show Comment Global/Project
|
||||
</ul>
|
||||
|
||||
@@ -38,6 +36,7 @@
|
||||
|
||||
<h3>外部注释:</h3>
|
||||
<a href="https://gitee.com/LinWanCen/show-comment/tree/main/src/test/java/io/github/linwancen/plugin/show/demo/ext">示例(Gitee)</a>
|
||||
:比如你要给 .go 的文件配置文件注释可以放在相同目录或父目录的 xxx.go.tree.tsv 中
|
||||
<ul>
|
||||
<li>重新加载:工具 -> "🔄 // Reload External Comment"
|
||||
<li>path/[any][filename.]ext.tree.tsv // 文件(夹)注释 📝 📁
|
||||
@@ -48,6 +47,10 @@
|
||||
<li>在搜索弹出窗中修改 tsv 文件将不会被重加载
|
||||
<li>tsv 配置文件必须能被搜索(Ctrl + Shift + N)
|
||||
</ul>
|
||||
|
||||
如果对你有所帮助,别忘了给本项目
|
||||
<a href="https://github.com/LinWanCen/show-comment">GitHub</a>
|
||||
主页一个 Start,您的支持是项目前进的动力。
|
||||
]]></description>
|
||||
|
||||
<!-- please see https://plugins.jetbrains.com/docs/intellij/plugin-compatibility.html
|
||||
@@ -112,7 +115,7 @@
|
||||
<action
|
||||
id="io.github.linwancen.plugin.show.CopyReferenceSimple"
|
||||
class="io.github.linwancen.plugin.show.CopyReferenceSimple"
|
||||
text="Copy ClassName.MethodName">
|
||||
text="Copy Class.Method/File:Line">
|
||||
<add-to-group group-id="EditorPopupMenu" anchor="after"
|
||||
relative-to-action="CopyReference"/>
|
||||
</action>
|
||||
|
||||
Reference in New Issue
Block a user