feat(GroovyLangDoc): support Groovy | 支持 Groovy
This commit is contained in:
@@ -13,7 +13,7 @@ Show doc comment in the Project view Tree, line End, json, other
|
||||
|
||||
<h2>English Note</h2>
|
||||
<ul>
|
||||
<li>support Java Kotlin Scala JS/TS PHP Python Go Rust C SQL
|
||||
<li>support Java Kotlin Scala Groovy JS/TS PHP Python Go Rust C SQL
|
||||
<li>tree doc from lang or README.md pom .gradle etc. by settings
|
||||
<li>input `doc` `docc` -> /** */
|
||||
<li>json doc from xxx.json.tsv
|
||||
@@ -58,7 +58,7 @@ Show doc comment in the Project view Tree, line End, json, other
|
||||
<ul>
|
||||
<li>在结构树显示 文件注释 或 项目说明 (README.md pom.xml 等,可设置)
|
||||
<li>在行末尾显示 引用对象的文档注释,欢迎反馈您想要支持的语言,欢迎 C# 大神研究 CsLineEnd.java
|
||||
<li>目前支持 Java Kotlin Scala JS/TS PHP Python Go Rust C SQL
|
||||
<li>目前支持 Java Kotlin Scala Groovy JS/TS PHP Python Go Rust C SQL
|
||||
<li>输入 doc / docc 等生成 /** */
|
||||
<li>json 字段注释从 xxx.json.tsv 读取
|
||||
<li>json 字典注释从 键名.tsv 读取
|
||||
@@ -121,7 +121,7 @@ Show doc comment in the Project view Tree, line End, json, other
|
||||
|
||||
<h2>English Change Notes:</h2>
|
||||
<ul>
|
||||
<li>2.16 Add line-end-comment support Rust, PHP, C/C++/Object C, Scala
|
||||
<li>2.16 Add line-end-comment support Rust, 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")
|
||||
<li>2.13 ★ Cache for 2023.3
|
||||
@@ -166,7 +166,7 @@ Show doc comment in the Project view Tree, line End, json, other
|
||||
|
||||
<h2>中文更新说明:</h2>
|
||||
<ul>
|
||||
<li>2.16 增加 行末注释 支持 Rust, PHP, C/C++/Object C, Scala
|
||||
<li>2.16 增加 行末注释 支持 Rust, PHP, C/C++/Object C, Scala, Groovy
|
||||
<li>2.15 增加 行末注释 java 注解注释
|
||||
<li>2.14 增加 行末注释 java 枚举注释用于 Yes(1, "是")
|
||||
<li>2.13 ★ 缓存用于支持 2023.3
|
||||
|
||||
@@ -38,6 +38,7 @@ intellij {
|
||||
if ('IC' == ideTypeStr || 'IU' == ideTypeStr) {
|
||||
plugins.add('java')
|
||||
plugins.add('org.jetbrains.kotlin')
|
||||
plugins.add('org.intellij.groovy')
|
||||
} else if ('CL' == ideTypeStr) {
|
||||
plugins.add('com.intellij.clion-swift:201.6668.126')
|
||||
}
|
||||
@@ -92,7 +93,7 @@ patchPluginXml {
|
||||
changeNotes = """
|
||||
<h2>English Change Notes:</h2>
|
||||
<ul>
|
||||
<li>2.16 Add line-end-comment support Rust, PHP, C/C++/Object C, Scala
|
||||
<li>2.16 Add line-end-comment support Rust, 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")
|
||||
<li>2.13 ★ Cache for 2023.3
|
||||
@@ -137,7 +138,7 @@ patchPluginXml {
|
||||
|
||||
<h2>中文更新说明:</h2>
|
||||
<ul>
|
||||
<li>2.16 增加 行末注释 支持 Rust, PHP, C/C++/Object C, Scala
|
||||
<li>2.16 增加 行末注释 支持 Rust, PHP, C/C++/Object C, Scala, Groovy
|
||||
<li>2.15 增加 行末注释 java 注解注释
|
||||
<li>2.14 增加 行末注释 java 枚举注释用于 Yes(1, "是")
|
||||
<li>2.13 ★ 缓存用于支持 2023.3
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package io.github.linwancen.plugin.show.java;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import io.github.linwancen.plugin.show.bean.LineInfo;
|
||||
import io.github.linwancen.plugin.show.bean.SettingsInfo;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.plugins.groovy.GroovyLanguage;
|
||||
import org.jetbrains.plugins.groovy.lang.groovydoc.psi.api.GrDocFieldReference;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.types.GrCodeReferenceElement;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GroovyLangDoc extends JavaLangDoc {
|
||||
|
||||
public static final GroovyLangDoc INSTANCE = new GroovyLangDoc();
|
||||
|
||||
static {
|
||||
LANG_DOC_MAP.put(GroovyLanguage.INSTANCE.getID(), INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull List<Class<? extends PsiElement>> getRefClass() {
|
||||
return List.of(GrReferenceExpression.class, GrCodeReferenceElement.class, GrDocFieldReference.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean show(@NotNull LineInfo info) {
|
||||
return info.appSettings.showLineEndCommentGroovy;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected <T extends SettingsInfo> boolean parseBaseComment(@NotNull T info) {
|
||||
return info.appSettings.showLineEndCommentGroovyBase;
|
||||
}
|
||||
}
|
||||
@@ -15,8 +15,6 @@ import com.intellij.psi.PsiWhiteSpace;
|
||||
import com.intellij.psi.javadoc.PsiDocComment;
|
||||
import com.intellij.psi.javadoc.PsiDocTag;
|
||||
import com.intellij.psi.javadoc.PsiDocTagValue;
|
||||
import com.intellij.psi.javadoc.PsiDocToken;
|
||||
import com.intellij.psi.javadoc.PsiInlineDocTag;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import io.github.linwancen.plugin.show.bean.LineInfo;
|
||||
import io.github.linwancen.plugin.show.bean.SettingsInfo;
|
||||
@@ -146,18 +144,18 @@ public class JavaLangDoc extends BaseTagLangDoc<PsiDocComment> {
|
||||
* @return is a new line
|
||||
*/
|
||||
protected boolean appendElementText(@NotNull StringBuilder sb, PsiElement element) {
|
||||
if (element instanceof PsiDocToken) {
|
||||
@NotNull PsiDocToken psiDocToken = (PsiDocToken) element;
|
||||
DocFilter.addHtml(sb, psiDocToken.getText());
|
||||
if (element instanceof PsiWhiteSpace && sb.length() > 0) {
|
||||
return true;
|
||||
}
|
||||
if (element instanceof PsiInlineDocTag) {
|
||||
@NotNull PsiInlineDocTag psiInlineDocTag = (PsiInlineDocTag) element;
|
||||
@NotNull PsiElement[] children = psiInlineDocTag.getChildren();
|
||||
PsiElement[] children = element.getChildren();
|
||||
if (children.length > 0) {
|
||||
if (children.length >= 3) {
|
||||
DocFilter.addHtml(sb, children[children.length - 2].getText());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return element instanceof PsiWhiteSpace && sb.length() > 0;
|
||||
DocFilter.addHtml(sb, element.getText());
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,9 +24,11 @@ public class AppSettingsComponent {
|
||||
private final JBCheckBox showLineEndCommentJava = new JBCheckBox(" Java ");
|
||||
private final JBCheckBox showLineEndCommentJavaBase = new JBCheckBox("// Java ");
|
||||
private final JBCheckBox showLineEndCommentKotlin = new JBCheckBox(" Kotlin ");
|
||||
private final JBCheckBox showLineEndCommentScala = new JBCheckBox(" Scala ");
|
||||
private final JBCheckBox showLineEndCommentKotlinBase = new JBCheckBox("// Kotlin ");
|
||||
private final JBCheckBox showLineEndCommentScala = new JBCheckBox(" Scala ");
|
||||
private final JBCheckBox showLineEndCommentScalaBase = new JBCheckBox("// Scala ");
|
||||
private final JBCheckBox showLineEndCommentGroovy = new JBCheckBox(" Groovy ");
|
||||
private final JBCheckBox showLineEndCommentGroovyBase = new JBCheckBox("// Groovy ");
|
||||
private final JBCheckBox showLineEndCommentJs = new JBCheckBox(" js ");
|
||||
private final JBCheckBox showLineEndCommentJsBase = new JBCheckBox("// js ");
|
||||
private final JBCheckBox showLineEndCommentPhp = new JBCheckBox(" php ");
|
||||
@@ -71,12 +73,14 @@ public class AppSettingsComponent {
|
||||
.addComponent(JPanelFactory.of(
|
||||
showLineEndCommentJava,
|
||||
showLineEndCommentKotlin,
|
||||
showLineEndCommentScala
|
||||
showLineEndCommentScala,
|
||||
showLineEndCommentGroovy
|
||||
), 1)
|
||||
.addComponent(JPanelFactory.of(
|
||||
showLineEndCommentJavaBase,
|
||||
showLineEndCommentKotlinBase,
|
||||
showLineEndCommentScalaBase
|
||||
showLineEndCommentScalaBase,
|
||||
showLineEndCommentGroovyBase
|
||||
), 1)
|
||||
.addComponent(JPanelFactory.of(
|
||||
showLineEndCommentJs,
|
||||
@@ -202,6 +206,14 @@ public class AppSettingsComponent {
|
||||
showLineEndCommentScala.setSelected(newStatus);
|
||||
}
|
||||
|
||||
public boolean getShowLineEndCommentGroovy() {
|
||||
return showLineEndCommentGroovy.isSelected();
|
||||
}
|
||||
|
||||
public void setShowLineEndCommentGroovy(boolean newStatus) {
|
||||
showLineEndCommentGroovy.setSelected(newStatus);
|
||||
}
|
||||
|
||||
public boolean getShowLineEndCommentJs() {
|
||||
return showLineEndCommentJs.isSelected();
|
||||
}
|
||||
@@ -258,6 +270,14 @@ public class AppSettingsComponent {
|
||||
showLineEndCommentScalaBase.setSelected(newStatus);
|
||||
}
|
||||
|
||||
public boolean getShowLineEndCommentGroovyBase() {
|
||||
return showLineEndCommentGroovyBase.isSelected();
|
||||
}
|
||||
|
||||
public void setShowLineEndCommentGroovyBase(boolean newStatus) {
|
||||
showLineEndCommentGroovyBase.setSelected(newStatus);
|
||||
}
|
||||
|
||||
public boolean getShowLineEndCommentJsBase() {
|
||||
return showLineEndCommentJsBase.isSelected();
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ public class AppSettingsConfigurable implements Configurable {
|
||||
modified |= mySettingsComponent.getShowLineEndCommentJava() != settings.showLineEndCommentJava;
|
||||
modified |= mySettingsComponent.getShowLineEndCommentKotlin() != settings.showLineEndCommentKotlin;
|
||||
modified |= mySettingsComponent.getShowLineEndCommentScala() != settings.showLineEndCommentScala;
|
||||
modified |= mySettingsComponent.getShowLineEndCommentGroovy() != settings.showLineEndCommentGroovy;
|
||||
modified |= mySettingsComponent.getShowLineEndCommentJs() != settings.showLineEndCommentJs;
|
||||
modified |= mySettingsComponent.getShowLineEndCommentPhp() != settings.showLineEndCommentPhp;
|
||||
modified |= mySettingsComponent.getShowLineEndCommentPy() != settings.showLineEndCommentPy;
|
||||
@@ -51,6 +52,7 @@ public class AppSettingsConfigurable implements Configurable {
|
||||
modified |= mySettingsComponent.getShowLineEndCommentJavaBase() != settings.showLineEndCommentJavaBase;
|
||||
modified |= mySettingsComponent.getShowLineEndCommentKotlinBase() != settings.showLineEndCommentKotlinBase;
|
||||
modified |= mySettingsComponent.getShowLineEndCommentScalaBase() != settings.showLineEndCommentScalaBase;
|
||||
modified |= mySettingsComponent.getShowLineEndCommentGroovyBase() != settings.showLineEndCommentGroovyBase;
|
||||
modified |= mySettingsComponent.getShowLineEndCommentJsBase() != settings.showLineEndCommentJsBase;
|
||||
modified |= mySettingsComponent.getShowLineEndCommentPhpBase() != settings.showLineEndCommentPhpBase;
|
||||
modified |= mySettingsComponent.getShowLineEndCommentPyBase() != settings.showLineEndCommentPyBase;
|
||||
@@ -90,6 +92,7 @@ public class AppSettingsConfigurable implements Configurable {
|
||||
settings.showLineEndCommentJava = mySettingsComponent.getShowLineEndCommentJava();
|
||||
settings.showLineEndCommentKotlin = mySettingsComponent.getShowLineEndCommentKotlin();
|
||||
settings.showLineEndCommentScala = mySettingsComponent.getShowLineEndCommentScala();
|
||||
settings.showLineEndCommentGroovy = mySettingsComponent.getShowLineEndCommentGroovy();
|
||||
settings.showLineEndCommentJs = mySettingsComponent.getShowLineEndCommentJs();
|
||||
settings.showLineEndCommentPhp = mySettingsComponent.getShowLineEndCommentPhp();
|
||||
settings.showLineEndCommentPy = mySettingsComponent.getShowLineEndCommentPy();
|
||||
@@ -97,6 +100,7 @@ public class AppSettingsConfigurable implements Configurable {
|
||||
settings.showLineEndCommentJavaBase = mySettingsComponent.getShowLineEndCommentJavaBase();
|
||||
settings.showLineEndCommentKotlinBase = mySettingsComponent.getShowLineEndCommentKotlinBase();
|
||||
settings.showLineEndCommentScalaBase = mySettingsComponent.getShowLineEndCommentScalaBase();
|
||||
settings.showLineEndCommentGroovyBase = mySettingsComponent.getShowLineEndCommentGroovyBase();
|
||||
settings.showLineEndCommentJsBase = mySettingsComponent.getShowLineEndCommentJsBase();
|
||||
settings.showLineEndCommentPhpBase = mySettingsComponent.getShowLineEndCommentPhpBase();
|
||||
settings.showLineEndCommentPyBase = mySettingsComponent.getShowLineEndCommentPyBase();
|
||||
@@ -139,6 +143,7 @@ public class AppSettingsConfigurable implements Configurable {
|
||||
mySettingsComponent.setShowLineEndCommentJava(settings.showLineEndCommentJava);
|
||||
mySettingsComponent.setShowLineEndCommentKotlin(settings.showLineEndCommentKotlin);
|
||||
mySettingsComponent.setShowLineEndCommentScala(settings.showLineEndCommentScala);
|
||||
mySettingsComponent.setShowLineEndCommentGroovy(settings.showLineEndCommentGroovy);
|
||||
mySettingsComponent.setShowLineEndCommentJs(settings.showLineEndCommentJs);
|
||||
mySettingsComponent.setShowLineEndCommentPhp(settings.showLineEndCommentPhp);
|
||||
mySettingsComponent.setShowLineEndCommentPy(settings.showLineEndCommentPy);
|
||||
@@ -146,6 +151,7 @@ public class AppSettingsConfigurable implements Configurable {
|
||||
mySettingsComponent.setShowLineEndCommentJavaBase(settings.showLineEndCommentJavaBase);
|
||||
mySettingsComponent.setShowLineEndCommentKotlinBase(settings.showLineEndCommentKotlinBase);
|
||||
mySettingsComponent.setShowLineEndCommentScalaBase(settings.showLineEndCommentScalaBase);
|
||||
mySettingsComponent.setShowLineEndCommentGroovyBase(settings.showLineEndCommentGroovyBase);
|
||||
mySettingsComponent.setShowLineEndCommentJsBase(settings.showLineEndCommentJsBase);
|
||||
mySettingsComponent.setShowLineEndCommentPhpBase(settings.showLineEndCommentPhpBase);
|
||||
mySettingsComponent.setShowLineEndCommentPyBase(settings.showLineEndCommentPyBase);
|
||||
|
||||
@@ -35,6 +35,8 @@ public class AppSettingsState implements PersistentStateComponent<AppSettingsSta
|
||||
public boolean showLineEndCommentKotlinBase = false;
|
||||
public boolean showLineEndCommentScala = true;
|
||||
public boolean showLineEndCommentScalaBase = false;
|
||||
public boolean showLineEndCommentGroovy = true;
|
||||
public boolean showLineEndCommentGroovyBase = false;
|
||||
public boolean showLineEndCommentJs = true;
|
||||
public boolean showLineEndCommentJsBase = false;
|
||||
public boolean showLineEndCommentPhp = true;
|
||||
|
||||
5
src/main/resources/META-INF/groovy.xml
Normal file
5
src/main/resources/META-INF/groovy.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<idea-plugin>
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<editor.linePainter implementation="io.github.linwancen.plugin.show.java.GroovyLangDoc"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
@@ -11,7 +11,7 @@ Show doc comment in the Project view Tree, line End, json, other
|
||||
|
||||
<h2>English Note</h2>
|
||||
<ul>
|
||||
<li>support Java Kotlin Scala JS/TS PHP Python Go Rust C SQL
|
||||
<li>support Java Kotlin Scala Groovy JS/TS PHP Python Go Rust C SQL
|
||||
<li>tree doc from lang or README.md pom .gradle etc. by settings
|
||||
<li>input `doc` `docc` -> /** */
|
||||
<li>json doc from xxx.json.tsv
|
||||
@@ -56,7 +56,7 @@ Show doc comment in the Project view Tree, line End, json, other
|
||||
<ul>
|
||||
<li>在结构树显示 文件注释 或 项目说明 (README.md pom.xml 等,可设置)
|
||||
<li>在行末尾显示 引用对象的文档注释,欢迎反馈您想要支持的语言,欢迎 C# 大神研究 CsLineEnd.java
|
||||
<li>目前支持 Java Kotlin Scala JS/TS PHP Python Go Rust C SQL
|
||||
<li>目前支持 Java Kotlin Scala Groovy JS/TS PHP Python Go Rust C SQL
|
||||
<li>输入 doc / docc 等生成 /** */
|
||||
<li>json 字段注释从 xxx.json.tsv 读取
|
||||
<li>json 字典注释从 键名.tsv 读取
|
||||
@@ -122,6 +122,7 @@ Show doc comment in the Project view Tree, line End, json, other
|
||||
<depends optional="true" config-file="kotlin.xml">org.jetbrains.kotlin</depends>
|
||||
<!--suppress PluginXmlValidity -->
|
||||
<depends optional="true" config-file="scala.xml">org.intellij.scala</depends>
|
||||
<depends optional="true" config-file="groovy.xml">org.intellij.groovy</depends>
|
||||
<depends optional="true" config-file="sql.xml">com.intellij.database</depends>
|
||||
<depends optional="true" config-file="js.xml">JavaScript</depends>
|
||||
<depends optional="true" config-file="php.xml">com.jetbrains.php</depends>
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package io.github.linwancen.plugin.show.demo
|
||||
|
||||
/**
|
||||
* Foo
|
||||
*/
|
||||
class Foo {
|
||||
/** a */
|
||||
String a;
|
||||
/**
|
||||
* fun1
|
||||
*/
|
||||
def fun1(){
|
||||
a = 0;
|
||||
fun2()
|
||||
}
|
||||
/**
|
||||
* fun2
|
||||
*/
|
||||
def fun2(){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* abc
|
||||
* {@link Foo#fun2}
|
||||
* @author name
|
||||
*/
|
||||
static def fun3(){
|
||||
Foo.
|
||||
fun2()
|
||||
}
|
||||
Reference in New Issue
Block a user