feat(RubyLangDoc): support Ruby | 支持 Ruby
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>
|
<h2>English Note</h2>
|
||||||
<ul>
|
<ul>
|
||||||
<li>support Java Kotlin Scala Groovy JS/TS PHP Python Go Rust C SQL
|
<li>support Java Kotlin Scala Groovy JS/TS PHP Python Go Rust Ruby C SQL
|
||||||
<li>tree doc from lang or README.md pom .gradle etc. by settings
|
<li>tree doc from lang or README.md pom .gradle etc. by settings
|
||||||
<li>input `doc` `docc` -> /** */
|
<li>input `doc` `docc` -> /** */
|
||||||
<li>json doc from xxx.json.tsv
|
<li>json doc from xxx.json.tsv
|
||||||
@@ -58,7 +58,7 @@ Show doc comment in the Project view Tree, line End, json, other
|
|||||||
<ul>
|
<ul>
|
||||||
<li>在结构树显示 文件注释 或 项目说明 (README.md pom.xml 等,可设置)
|
<li>在结构树显示 文件注释 或 项目说明 (README.md pom.xml 等,可设置)
|
||||||
<li>在行末尾显示 引用对象的文档注释,欢迎反馈您想要支持的语言,欢迎 C# 大神研究 CsLineEnd.java
|
<li>在行末尾显示 引用对象的文档注释,欢迎反馈您想要支持的语言,欢迎 C# 大神研究 CsLineEnd.java
|
||||||
<li>目前支持 Java Kotlin Scala Groovy JS/TS PHP Python Go Rust C SQL
|
<li>目前支持 Java Kotlin Scala Groovy JS/TS PHP Python Go Rust Ruby C SQL
|
||||||
<li>输入 doc / docc 等生成 /** */
|
<li>输入 doc / docc 等生成 /** */
|
||||||
<li>json 字段注释从 xxx.json.tsv 读取
|
<li>json 字段注释从 xxx.json.tsv 读取
|
||||||
<li>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>
|
<h2>English Change Notes:</h2>
|
||||||
<ul>
|
<ul>
|
||||||
<li>2.16 Add line-end-comment support Rust, PHP, C/C++/Object C, Scala, Groovy
|
<li>2.16 Add line-end-comment support Rust, Ruby, PHP, C/C++/Object C, Scala, Groovy
|
||||||
<li>2.15 Add line-end-comment java anno doc
|
<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.14 Add line-end-comment java enum doc for Yes(1, "Yes")
|
||||||
<li>2.13 ★ Cache for 2023.3
|
<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>
|
<h2>中文更新说明:</h2>
|
||||||
<ul>
|
<ul>
|
||||||
<li>2.16 增加 行末注释 支持 Rust, PHP, C/C++/Object C, Scala, Groovy
|
<li>2.16 增加 行末注释 支持 Rust, Ruby, PHP, C/C++/Object C, Scala, Groovy
|
||||||
<li>2.15 增加 行末注释 java 注解注释
|
<li>2.15 增加 行末注释 java 注解注释
|
||||||
<li>2.14 增加 行末注释 java 枚举注释用于 Yes(1, "是")
|
<li>2.14 增加 行末注释 java 枚举注释用于 Yes(1, "是")
|
||||||
<li>2.13 ★ 缓存用于支持 2023.3
|
<li>2.13 ★ 缓存用于支持 2023.3
|
||||||
|
|||||||
@@ -33,12 +33,13 @@ intellij {
|
|||||||
'Pythonid:201.6668.121',
|
'Pythonid:201.6668.121',
|
||||||
'org.rust.lang:0.3.131.3366-201',
|
'org.rust.lang:0.3.131.3366-201',
|
||||||
'org.toml.lang:0.2.131.3366-201',
|
'org.toml.lang:0.2.131.3366-201',
|
||||||
'org.intellij.scala:2020.1.43',
|
'org.jetbrains.plugins.ruby:201.6668.113',
|
||||||
]
|
]
|
||||||
if ('IC' == ideTypeStr || 'IU' == ideTypeStr) {
|
if ('IC' == ideTypeStr || 'IU' == ideTypeStr) {
|
||||||
plugins.add('java')
|
plugins.add('java')
|
||||||
plugins.add('org.jetbrains.kotlin')
|
plugins.add('org.jetbrains.kotlin')
|
||||||
plugins.add('org.intellij.groovy')
|
plugins.add('org.intellij.groovy')
|
||||||
|
plugins.add('org.intellij.scala:2020.1.43')
|
||||||
} else if ('CL' == ideTypeStr) {
|
} else if ('CL' == ideTypeStr) {
|
||||||
plugins.add('com.intellij.clion-swift:201.6668.126')
|
plugins.add('com.intellij.clion-swift:201.6668.126')
|
||||||
}
|
}
|
||||||
@@ -93,7 +94,7 @@ patchPluginXml {
|
|||||||
changeNotes = """
|
changeNotes = """
|
||||||
<h2>English Change Notes:</h2>
|
<h2>English Change Notes:</h2>
|
||||||
<ul>
|
<ul>
|
||||||
<li>2.16 Add line-end-comment support Rust, PHP, C/C++/Object C, Scala, Groovy
|
<li>2.16 Add line-end-comment support Rust, Ruby, PHP, C/C++/Object C, Scala, Groovy
|
||||||
<li>2.15 Add line-end-comment java anno doc
|
<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.14 Add line-end-comment java enum doc for Yes(1, "Yes")
|
||||||
<li>2.13 ★ Cache for 2023.3
|
<li>2.13 ★ Cache for 2023.3
|
||||||
@@ -138,7 +139,7 @@ patchPluginXml {
|
|||||||
|
|
||||||
<h2>中文更新说明:</h2>
|
<h2>中文更新说明:</h2>
|
||||||
<ul>
|
<ul>
|
||||||
<li>2.16 增加 行末注释 支持 Rust, PHP, C/C++/Object C, Scala, Groovy
|
<li>2.16 增加 行末注释 支持 Rust, Ruby, PHP, C/C++/Object C, Scala, Groovy
|
||||||
<li>2.15 增加 行末注释 java 注解注释
|
<li>2.15 增加 行末注释 java 注解注释
|
||||||
<li>2.14 增加 行末注释 java 枚举注释用于 Yes(1, "是")
|
<li>2.14 增加 行末注释 java 枚举注释用于 Yes(1, "是")
|
||||||
<li>2.13 ★ 缓存用于支持 2023.3
|
<li>2.13 ★ 缓存用于支持 2023.3
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package io.github.linwancen.plugin.show.lang;
|
||||||
|
|
||||||
|
import com.intellij.psi.PsiElement;
|
||||||
|
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.plugins.ruby.ruby.lang.RubyLanguage;
|
||||||
|
import org.jetbrains.plugins.ruby.ruby.lang.psi.references.RDotReference;
|
||||||
|
import org.jetbrains.plugins.ruby.ruby.lang.psi.variables.RIdentifier;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class RubyLangDoc extends BaseLangDoc {
|
||||||
|
|
||||||
|
static {
|
||||||
|
LANG_DOC_MAP.put(RubyLanguage.INSTANCE.getID(), new RubyLangDoc());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull List<Class<? extends PsiElement>> getRefClass() {
|
||||||
|
return List.of(RDotReference.class, RIdentifier.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean show(@NotNull LineInfo info) {
|
||||||
|
return info.appSettings.showLineEndCommentRubyBase;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -38,6 +38,7 @@ public class AppSettingsComponent {
|
|||||||
private final JBCheckBox showLineEndCommentGo = new JBCheckBox(" Go ");
|
private final JBCheckBox showLineEndCommentGo = new JBCheckBox(" Go ");
|
||||||
private final JBCheckBox showLineEndCommentGoBase = new JBCheckBox("// Go ");
|
private final JBCheckBox showLineEndCommentGoBase = new JBCheckBox("// Go ");
|
||||||
private final JBCheckBox showLineEndCommentRustBase = new JBCheckBox("// Rust ");
|
private final JBCheckBox showLineEndCommentRustBase = new JBCheckBox("// Rust ");
|
||||||
|
private final JBCheckBox showLineEndCommentRubyBase = new JBCheckBox("// Ruby ");
|
||||||
private final JBCheckBox showLineEndCommentCBase = new JBCheckBox("// C ");
|
private final JBCheckBox showLineEndCommentCBase = new JBCheckBox("// C ");
|
||||||
private final JBCheckBox showLineEndCommentSwiftBase = new JBCheckBox("// Swift ");
|
private final JBCheckBox showLineEndCommentSwiftBase = new JBCheckBox("// Swift ");
|
||||||
private final JBCheckBox showLineEndCommentSql = new JBCheckBox(" sql ");
|
private final JBCheckBox showLineEndCommentSql = new JBCheckBox(" sql ");
|
||||||
@@ -318,6 +319,14 @@ public class AppSettingsComponent {
|
|||||||
showLineEndCommentRustBase.setSelected(newStatus);
|
showLineEndCommentRustBase.setSelected(newStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getShowLineEndCommentRubyBase() {
|
||||||
|
return showLineEndCommentRubyBase.isSelected();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShowLineEndCommentRubyBase(boolean newStatus) {
|
||||||
|
showLineEndCommentRubyBase.setSelected(newStatus);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean getShowLineEndCommentCBase() {
|
public boolean getShowLineEndCommentCBase() {
|
||||||
return showLineEndCommentCBase.isSelected();
|
return showLineEndCommentCBase.isSelected();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ public class AppSettingsConfigurable implements Configurable {
|
|||||||
modified |= mySettingsComponent.getShowLineEndCommentPyBase() != settings.showLineEndCommentPyBase;
|
modified |= mySettingsComponent.getShowLineEndCommentPyBase() != settings.showLineEndCommentPyBase;
|
||||||
modified |= mySettingsComponent.getShowLineEndCommentGoBase() != settings.showLineEndCommentGoBase;
|
modified |= mySettingsComponent.getShowLineEndCommentGoBase() != settings.showLineEndCommentGoBase;
|
||||||
modified |= mySettingsComponent.getShowLineEndCommentRustBase() != settings.showLineEndCommentRustBase;
|
modified |= mySettingsComponent.getShowLineEndCommentRustBase() != settings.showLineEndCommentRustBase;
|
||||||
|
modified |= mySettingsComponent.getShowLineEndCommentRubyBase() != settings.showLineEndCommentRubyBase;
|
||||||
modified |= mySettingsComponent.getShowLineEndCommentCBase() != settings.showLineEndCommentCBase;
|
modified |= mySettingsComponent.getShowLineEndCommentCBase() != settings.showLineEndCommentCBase;
|
||||||
modified |= mySettingsComponent.getShowLineEndCommentSwiftBase() != settings.showLineEndCommentSwiftBase;
|
modified |= mySettingsComponent.getShowLineEndCommentSwiftBase() != settings.showLineEndCommentSwiftBase;
|
||||||
modified |= mySettingsComponent.getShowLineEndCommentSql() != settings.showLineEndCommentSql;
|
modified |= mySettingsComponent.getShowLineEndCommentSql() != settings.showLineEndCommentSql;
|
||||||
@@ -106,6 +107,7 @@ public class AppSettingsConfigurable implements Configurable {
|
|||||||
settings.showLineEndCommentPyBase = mySettingsComponent.getShowLineEndCommentPyBase();
|
settings.showLineEndCommentPyBase = mySettingsComponent.getShowLineEndCommentPyBase();
|
||||||
settings.showLineEndCommentGoBase = mySettingsComponent.getShowLineEndCommentGoBase();
|
settings.showLineEndCommentGoBase = mySettingsComponent.getShowLineEndCommentGoBase();
|
||||||
settings.showLineEndCommentRustBase = mySettingsComponent.getShowLineEndCommentRustBase();
|
settings.showLineEndCommentRustBase = mySettingsComponent.getShowLineEndCommentRustBase();
|
||||||
|
settings.showLineEndCommentRubyBase = mySettingsComponent.getShowLineEndCommentRubyBase();
|
||||||
settings.showLineEndCommentCBase = mySettingsComponent.getShowLineEndCommentCBase();
|
settings.showLineEndCommentCBase = mySettingsComponent.getShowLineEndCommentCBase();
|
||||||
settings.showLineEndCommentSwiftBase = mySettingsComponent.getShowLineEndCommentSwiftBase();
|
settings.showLineEndCommentSwiftBase = mySettingsComponent.getShowLineEndCommentSwiftBase();
|
||||||
settings.showLineEndCommentSql = mySettingsComponent.getShowLineEndCommentSql();
|
settings.showLineEndCommentSql = mySettingsComponent.getShowLineEndCommentSql();
|
||||||
@@ -157,6 +159,7 @@ public class AppSettingsConfigurable implements Configurable {
|
|||||||
mySettingsComponent.setShowLineEndCommentPyBase(settings.showLineEndCommentPyBase);
|
mySettingsComponent.setShowLineEndCommentPyBase(settings.showLineEndCommentPyBase);
|
||||||
mySettingsComponent.setShowLineEndCommentGoBase(settings.showLineEndCommentGoBase);
|
mySettingsComponent.setShowLineEndCommentGoBase(settings.showLineEndCommentGoBase);
|
||||||
mySettingsComponent.setShowLineEndCommentRustBase(settings.showLineEndCommentRustBase);
|
mySettingsComponent.setShowLineEndCommentRustBase(settings.showLineEndCommentRustBase);
|
||||||
|
mySettingsComponent.setShowLineEndCommentRubyBase(settings.showLineEndCommentRubyBase);
|
||||||
mySettingsComponent.setShowLineEndCommentCBase(settings.showLineEndCommentCBase);
|
mySettingsComponent.setShowLineEndCommentCBase(settings.showLineEndCommentCBase);
|
||||||
mySettingsComponent.setShowLineEndCommentSwiftBase(settings.showLineEndCommentSwiftBase);
|
mySettingsComponent.setShowLineEndCommentSwiftBase(settings.showLineEndCommentSwiftBase);
|
||||||
mySettingsComponent.setShowLineEndCommentSql(settings.showLineEndCommentSql);
|
mySettingsComponent.setShowLineEndCommentSql(settings.showLineEndCommentSql);
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ public class AppSettingsState implements PersistentStateComponent<AppSettingsSta
|
|||||||
public boolean showLineEndCommentGo = true;
|
public boolean showLineEndCommentGo = true;
|
||||||
public boolean showLineEndCommentGoBase = false;
|
public boolean showLineEndCommentGoBase = false;
|
||||||
public boolean showLineEndCommentRustBase = true;
|
public boolean showLineEndCommentRustBase = true;
|
||||||
|
public boolean showLineEndCommentRubyBase = true;
|
||||||
public boolean showLineEndCommentCBase = true;
|
public boolean showLineEndCommentCBase = true;
|
||||||
public boolean showLineEndCommentSwiftBase = true;
|
public boolean showLineEndCommentSwiftBase = true;
|
||||||
public boolean showLineEndCommentSql = true;
|
public boolean showLineEndCommentSql = true;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ Show doc comment in the Project view Tree, line End, json, other
|
|||||||
|
|
||||||
<h2>English Note</h2>
|
<h2>English Note</h2>
|
||||||
<ul>
|
<ul>
|
||||||
<li>support Java Kotlin Scala Groovy JS/TS PHP Python Go Rust C SQL
|
<li>support Java Kotlin Scala Groovy JS/TS PHP Python Go Rust Ruby C SQL
|
||||||
<li>tree doc from lang or README.md pom .gradle etc. by settings
|
<li>tree doc from lang or README.md pom .gradle etc. by settings
|
||||||
<li>input `doc` `docc` -> /** */
|
<li>input `doc` `docc` -> /** */
|
||||||
<li>json doc from xxx.json.tsv
|
<li>json doc from xxx.json.tsv
|
||||||
@@ -56,7 +56,7 @@ Show doc comment in the Project view Tree, line End, json, other
|
|||||||
<ul>
|
<ul>
|
||||||
<li>在结构树显示 文件注释 或 项目说明 (README.md pom.xml 等,可设置)
|
<li>在结构树显示 文件注释 或 项目说明 (README.md pom.xml 等,可设置)
|
||||||
<li>在行末尾显示 引用对象的文档注释,欢迎反馈您想要支持的语言,欢迎 C# 大神研究 CsLineEnd.java
|
<li>在行末尾显示 引用对象的文档注释,欢迎反馈您想要支持的语言,欢迎 C# 大神研究 CsLineEnd.java
|
||||||
<li>目前支持 Java Kotlin Scala Groovy JS/TS PHP Python Go Rust C SQL
|
<li>目前支持 Java Kotlin Scala Groovy JS/TS PHP Python Go Rust Ruby C SQL
|
||||||
<li>输入 doc / docc 等生成 /** */
|
<li>输入 doc / docc 等生成 /** */
|
||||||
<li>json 字段注释从 xxx.json.tsv 读取
|
<li>json 字段注释从 xxx.json.tsv 读取
|
||||||
<li>json 字典注释从 键名.tsv 读取
|
<li>json 字典注释从 键名.tsv 读取
|
||||||
@@ -120,9 +120,9 @@ Show doc comment in the Project view Tree, line End, json, other
|
|||||||
<depends>com.intellij.modules.platform</depends>
|
<depends>com.intellij.modules.platform</depends>
|
||||||
<depends optional="true" config-file="java.xml">com.intellij.modules.java</depends>
|
<depends optional="true" config-file="java.xml">com.intellij.modules.java</depends>
|
||||||
<depends optional="true" config-file="kotlin.xml">org.jetbrains.kotlin</depends>
|
<depends optional="true" config-file="kotlin.xml">org.jetbrains.kotlin</depends>
|
||||||
|
<depends optional="true" config-file="groovy.xml">org.intellij.groovy</depends>
|
||||||
<!--suppress PluginXmlValidity -->
|
<!--suppress PluginXmlValidity -->
|
||||||
<depends optional="true" config-file="scala.xml">org.intellij.scala</depends>
|
<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="sql.xml">com.intellij.database</depends>
|
||||||
<depends optional="true" config-file="js.xml">JavaScript</depends>
|
<depends optional="true" config-file="js.xml">JavaScript</depends>
|
||||||
<depends optional="true" config-file="php.xml">com.jetbrains.php</depends>
|
<depends optional="true" config-file="php.xml">com.jetbrains.php</depends>
|
||||||
@@ -132,6 +132,7 @@ Show doc comment in the Project view Tree, line End, json, other
|
|||||||
<depends optional="true" config-file="rust_old.xml">org.rust.lang</depends>
|
<depends optional="true" config-file="rust_old.xml">org.rust.lang</depends>
|
||||||
<!--suppress PluginXmlValidity -->
|
<!--suppress PluginXmlValidity -->
|
||||||
<depends optional="true" config-file="rust.xml">com.jetbrains.rust</depends>
|
<depends optional="true" config-file="rust.xml">com.jetbrains.rust</depends>
|
||||||
|
<depends optional="true" config-file="ruby.xml">com.intellij.modules.ruby</depends>
|
||||||
<!--suppress PluginXmlValidity -->
|
<!--suppress PluginXmlValidity -->
|
||||||
<depends optional="true" config-file="c.xml">com.intellij.modules.clion</depends>
|
<depends optional="true" config-file="c.xml">com.intellij.modules.clion</depends>
|
||||||
<!--suppress PluginXmlValidity -->
|
<!--suppress PluginXmlValidity -->
|
||||||
|
|||||||
5
src/main/resources/META-INF/ruby.xml
Normal file
5
src/main/resources/META-INF/ruby.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<idea-plugin>
|
||||||
|
<extensions defaultExtensionNs="com.intellij">
|
||||||
|
<editor.linePainter implementation="io.github.linwancen.plugin.show.lang.RubyLangDoc"/>
|
||||||
|
</extensions>
|
||||||
|
</idea-plugin>
|
||||||
36
src/test/java/io/github/linwancen/plugin/show/demo/ruby.rb
Normal file
36
src/test/java/io/github/linwancen/plugin/show/demo/ruby.rb
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
lwc = Human.new("lwc")
|
||||||
|
lwc.met1("Hi")
|
||||||
|
|
||||||
|
# fun
|
||||||
|
def fun(x,y)
|
||||||
|
fun2
|
||||||
|
fun3("Hi")
|
||||||
|
h = Human.new
|
||||||
|
h.met2
|
||||||
|
end
|
||||||
|
|
||||||
|
# fun2
|
||||||
|
def fun2()
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
# fun3
|
||||||
|
def fun3(msg)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
# class
|
||||||
|
class Human
|
||||||
|
# Human
|
||||||
|
|
||||||
|
# met1 #met2
|
||||||
|
def met1(msg)
|
||||||
|
met2
|
||||||
|
end
|
||||||
|
|
||||||
|
# met2
|
||||||
|
def met2
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user