feat(RustLangDoc): 2.16 support Rust | 支持 Rust
This commit is contained in:
22
README.md
22
README.md
@@ -3,7 +3,7 @@
|
||||
[](https://plugins.jetbrains.com/plugin/18553-show-comment/versions)
|
||||
[](https://plugins.jetbrains.com/plugin/18553-show-comment)
|
||||
|
||||
Thanks JetBrains Licenses for Open Source.
|
||||
Thanks to JetBrains Licenses for Open Source.
|
||||
|
||||
## Notes 说明
|
||||
|
||||
@@ -13,12 +13,14 @@ Show doc comment at the Project view Tree, line End, json, other
|
||||
|
||||
<h2>English Note</h2>
|
||||
<ul>
|
||||
<li>"xx-ClassNameOrSimpleName.json" and jump to field
|
||||
<li>support Java Kotlin JS/TS Python Go Rust 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
|
||||
<li>json dict doc from (key).tsv
|
||||
<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
|
||||
<li>Config: settings -> Tools -> // Show Comment App/Global/Project
|
||||
</ul>
|
||||
|
||||
<h3>External Comment</h3>
|
||||
@@ -51,14 +53,14 @@ Show doc comment at the Project view Tree, line End, json, other
|
||||
<hr>
|
||||
<h2>中文说明</h2>
|
||||
<ul>
|
||||
<li>在结构树显示 文档注释
|
||||
<li>在行末尾显示 文档注释
|
||||
<li>在行末尾显示 引用对象的文档注释,支持 Java Kotlin JS/TS Python Go Rust SQL
|
||||
<li>在结构树显示 文件注释 或 项目说明 (README.md pom.xml 等,可设置)
|
||||
<li>输入 doc / docc 等生成 /** */
|
||||
<li>json 字段注释从 xxx.json.tsv 读取
|
||||
<li>json 字典注释从 键名.tsv 读取
|
||||
<li>支持 "xx-类全名或简名.json" 文档注释与跳转到字段
|
||||
<li>支持 "xx-类全名或简名.json" 读取字段注释和跳转
|
||||
<li>支持 从配置文件获取外部注释用于文件夹、资源、COBOL 等
|
||||
<li>修改配置:设置 -> 工具 -> // Show Comment Global/Project
|
||||
<li>修改配置:设置 -> 工具 -> // Show Comment App/Global/Project
|
||||
</ul>
|
||||
|
||||
<h3>外部注释</h3>
|
||||
@@ -95,13 +97,13 @@ Show doc comment at the Project view Tree, line End, json, other
|
||||
<li>我的情况:1993-11-03,软件工程师,广发银行编制,宅,LOLm,NS,看书,写文章,KTV,爬山,逛街
|
||||
<li>我的性格:ISFP(探险家 内向 实际 感性 随性)
|
||||
<li>希望对方:广东省,与家人关系好,爱笑甜美大眼睛
|
||||
<li>有兴趣请联系 1498425439@qq.com
|
||||
<li>有兴趣请联系 1498425439@qq.com,也欢迎反馈问题和需求
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
<h2>支持</h2>
|
||||
<ul>
|
||||
<li>如果对你有所帮助,别忘了给本项目
|
||||
<li>如果对你有所帮助,可以通过群或文章等形式分享给大家,在插件市场好评,或者给本项目
|
||||
<a href="https://github.com/LinWanCen/show-comment">GitHub</a>
|
||||
主页一个 Star,您的支持是项目前进的动力。
|
||||
</ul>
|
||||
@@ -112,6 +114,7 @@ Show doc comment at the Project view Tree, line End, json, other
|
||||
|
||||
<h2>English Change Notes:</h2>
|
||||
<ul>
|
||||
<li>2.16 Add line-end-comment support Rust
|
||||
<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
|
||||
@@ -156,6 +159,7 @@ Show doc comment at the Project view Tree, line End, json, other
|
||||
|
||||
<h2>中文更新说明:</h2>
|
||||
<ul>
|
||||
<li>2.16 增加 行末注释 支持 Rust
|
||||
<li>2.15 增加 行末注释 java 注解注释
|
||||
<li>2.14 增加 行末注释 java 枚举注释用于 Yes(1, "是")
|
||||
<li>2.13 ★ 缓存用于支持 2023.3
|
||||
|
||||
@@ -4,7 +4,7 @@ plugins {
|
||||
}
|
||||
|
||||
group 'io.github.linwancen'
|
||||
version '2.15.0.' + (new Date().format('yyyy.MM.dd_HH.mm'))
|
||||
version '2.16.0.' + (new Date().format('yyyy.MM.dd_HH.mm'))
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@@ -30,6 +30,9 @@ intellij {
|
||||
// see https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#intellij-extension-plugins
|
||||
plugins = [
|
||||
'Pythonid:201.6668.121',
|
||||
'org.rust.lang:0.3.131.3366-201',
|
||||
'org.toml.lang:0.2.131.3366-201',
|
||||
// 'com.jetbrains.rust:232.9921.46',
|
||||
// 'Pythonid:212.5284.44',
|
||||
]
|
||||
if ('IC' == ideTypeStr || 'IU' == ideTypeStr) {
|
||||
@@ -88,6 +91,7 @@ patchPluginXml {
|
||||
changeNotes = """
|
||||
<h2>English Change Notes:</h2>
|
||||
<ul>
|
||||
<li>2.16 Add line-end-comment support Rust
|
||||
<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
|
||||
@@ -132,6 +136,7 @@ patchPluginXml {
|
||||
|
||||
<h2>中文更新说明:</h2>
|
||||
<ul>
|
||||
<li>2.16 增加 行末注释 支持 Rust
|
||||
<li>2.15 增加 行末注释 java 注解注释
|
||||
<li>2.14 增加 行末注释 java 枚举注释用于 Yes(1, "是")
|
||||
<li>2.13 ★ 缓存用于支持 2023.3
|
||||
|
||||
@@ -74,7 +74,7 @@ public class JavaLangDoc extends BaseTagLangDoc<PsiDocComment> {
|
||||
if (resolveDocPrint != null) {
|
||||
return resolveDocPrint;
|
||||
}
|
||||
// no doc comment support get set
|
||||
// no doc comment support get/set
|
||||
if (parseBaseComment(info) && resolve instanceof PsiMethod) {
|
||||
@Nullable PsiField psiField = PsiMethodToPsiDoc.propMethodField((PsiMethod) resolve);
|
||||
if (psiField != null) {
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
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.rust.lang.RsLanguage;
|
||||
import org.rust.lang.core.psi.RsPath;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RustLangDoc extends BaseLangDoc {
|
||||
|
||||
static {
|
||||
LANG_DOC_MAP.put(RsLanguage.INSTANCE.getID(), new RustLangDoc());
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull List<Class<? extends PsiElement>> getRefClass() {
|
||||
return List.of(RsPath.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean show(@NotNull LineInfo info) {
|
||||
return info.appSettings.showLineEndCommentRustBase;
|
||||
}
|
||||
}
|
||||
@@ -21,16 +21,17 @@ public class AppSettingsComponent {
|
||||
private final JBTextField treeTags = new JBTextField();
|
||||
private final JBCheckBox showLineEndComment = new JBCheckBox(ShowBundle.message("show.line.end.comment"));
|
||||
private final JBCheckBox lineEndCache = new JBCheckBox(ShowBundle.message("line.end.cache"));
|
||||
private final JBCheckBox showLineEndCommentJava = new JBCheckBox(" Java ");
|
||||
private final JBCheckBox showLineEndCommentJava = new JBCheckBox(" Java ");
|
||||
private final JBCheckBox showLineEndCommentJavaBase = new JBCheckBox("// Java ");
|
||||
private final JBCheckBox showLineEndCommentKotlin = new JBCheckBox(" Kotlin ");
|
||||
private final JBCheckBox showLineEndCommentKotlin = new JBCheckBox(" Kotlin ");
|
||||
private final JBCheckBox showLineEndCommentKotlinBase = new JBCheckBox("// Kotlin ");
|
||||
private final JBCheckBox showLineEndCommentJs = new JBCheckBox(" js ");
|
||||
private final JBCheckBox showLineEndCommentJs = new JBCheckBox(" js ");
|
||||
private final JBCheckBox showLineEndCommentJsBase = new JBCheckBox("// js ");
|
||||
private final JBCheckBox showLineEndCommentPy = new JBCheckBox(" Python ");
|
||||
private final JBCheckBox showLineEndCommentPy = new JBCheckBox(" Python ");
|
||||
private final JBCheckBox showLineEndCommentPyBase = new JBCheckBox("# Python ");
|
||||
private final JBCheckBox showLineEndCommentGo = new JBCheckBox(" Go ");
|
||||
private final JBCheckBox showLineEndCommentGo = new JBCheckBox(" Go ");
|
||||
private final JBCheckBox showLineEndCommentGoBase = new JBCheckBox("// Go ");
|
||||
private final JBCheckBox showLineEndCommentRustBase = new JBCheckBox("// Rust ");
|
||||
private final JBCheckBox showLineEndCommentSql = new JBCheckBox(" sql ");
|
||||
private final JBCheckBox showLineEndCommentJson = new JBCheckBox(" json ");
|
||||
private final JBTextField lineTags = new JBTextField();
|
||||
@@ -74,7 +75,8 @@ public class AppSettingsComponent {
|
||||
showLineEndCommentJavaBase,
|
||||
showLineEndCommentKotlinBase,
|
||||
showLineEndCommentJsBase,
|
||||
showLineEndCommentPyBase
|
||||
showLineEndCommentPyBase,
|
||||
showLineEndCommentRustBase
|
||||
), 1)
|
||||
.addLabeledComponent(new JBLabel(ShowBundle.message("tree.tags")), treeTags, 1, true)
|
||||
.addLabeledComponent(new JBLabel(ShowBundle.message("line.tags")), lineTags, 1, true)
|
||||
@@ -238,6 +240,14 @@ public class AppSettingsComponent {
|
||||
showLineEndCommentGoBase.setSelected(newStatus);
|
||||
}
|
||||
|
||||
public boolean getShowLineEndCommentRustBase() {
|
||||
return showLineEndCommentRustBase.isSelected();
|
||||
}
|
||||
|
||||
public void setShowLineEndCommentRustBase(boolean newStatus) {
|
||||
showLineEndCommentRustBase.setSelected(newStatus);
|
||||
}
|
||||
|
||||
public boolean getShowLineEndCommentSql() {
|
||||
return showLineEndCommentSql.isSelected();
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ public class AppSettingsConfigurable implements Configurable {
|
||||
modified |= mySettingsComponent.getShowLineEndCommentJsBase() != settings.showLineEndCommentJsBase;
|
||||
modified |= mySettingsComponent.getShowLineEndCommentPyBase() != settings.showLineEndCommentPyBase;
|
||||
modified |= mySettingsComponent.getShowLineEndCommentGoBase() != settings.showLineEndCommentGoBase;
|
||||
modified |= mySettingsComponent.getShowLineEndCommentRustBase() != settings.showLineEndCommentRustBase;
|
||||
modified |= mySettingsComponent.getShowLineEndCommentSql() != settings.showLineEndCommentSql;
|
||||
modified |= mySettingsComponent.getShowLineEndCommentJson() != settings.showLineEndCommentJson;
|
||||
|
||||
@@ -90,6 +91,7 @@ public class AppSettingsConfigurable implements Configurable {
|
||||
settings.showLineEndCommentJsBase = mySettingsComponent.getShowLineEndCommentJsBase();
|
||||
settings.showLineEndCommentPyBase = mySettingsComponent.getShowLineEndCommentPyBase();
|
||||
settings.showLineEndCommentGoBase = mySettingsComponent.getShowLineEndCommentGoBase();
|
||||
settings.showLineEndCommentRustBase = mySettingsComponent.getShowLineEndCommentRustBase();
|
||||
settings.showLineEndCommentSql = mySettingsComponent.getShowLineEndCommentSql();
|
||||
settings.showLineEndCommentJson = mySettingsComponent.getShowLineEndCommentJson();
|
||||
|
||||
@@ -132,6 +134,7 @@ public class AppSettingsConfigurable implements Configurable {
|
||||
mySettingsComponent.setShowLineEndCommentJsBase(settings.showLineEndCommentJsBase);
|
||||
mySettingsComponent.setShowLineEndCommentPyBase(settings.showLineEndCommentPyBase);
|
||||
mySettingsComponent.setShowLineEndCommentGoBase(settings.showLineEndCommentGoBase);
|
||||
mySettingsComponent.setShowLineEndCommentRustBase(settings.showLineEndCommentRustBase);
|
||||
mySettingsComponent.setShowLineEndCommentSql(settings.showLineEndCommentSql);
|
||||
mySettingsComponent.setShowLineEndCommentJson(settings.showLineEndCommentJson);
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ public class AppSettingsState implements PersistentStateComponent<AppSettingsSta
|
||||
public boolean showLineEndCommentPyBase = false;
|
||||
public boolean showLineEndCommentGo = true;
|
||||
public boolean showLineEndCommentGoBase = false;
|
||||
public boolean showLineEndCommentRustBase = true;
|
||||
public boolean showLineEndCommentSql = true;
|
||||
public boolean showLineEndCommentJson = true;
|
||||
|
||||
|
||||
@@ -11,12 +11,14 @@ Show doc comment at the Project view Tree, line End, json, other
|
||||
|
||||
<h2>English Note</h2>
|
||||
<ul>
|
||||
<li>"xx-ClassNameOrSimpleName.json" and jump to field
|
||||
<li>support Java Kotlin JS/TS Python Go Rust 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
|
||||
<li>json dict doc from (key).tsv
|
||||
<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
|
||||
<li>Config: settings -> Tools -> // Show Comment App/Global/Project
|
||||
</ul>
|
||||
|
||||
<h3>External Comment</h3>
|
||||
@@ -49,14 +51,14 @@ Show doc comment at the Project view Tree, line End, json, other
|
||||
<hr>
|
||||
<h2>中文说明</h2>
|
||||
<ul>
|
||||
<li>在结构树显示 文档注释
|
||||
<li>在行末尾显示 文档注释
|
||||
<li>在行末尾显示 引用对象的文档注释,支持 Java Kotlin JS/TS Python Go Rust SQL
|
||||
<li>在结构树显示 文件注释 或 项目说明 (README.md pom.xml 等,可设置)
|
||||
<li>输入 doc / docc 等生成 /** */
|
||||
<li>json 字段注释从 xxx.json.tsv 读取
|
||||
<li>json 字典注释从 键名.tsv 读取
|
||||
<li>支持 "xx-类全名或简名.json" 文档注释与跳转到字段
|
||||
<li>支持 "xx-类全名或简名.json" 读取字段注释和跳转
|
||||
<li>支持 从配置文件获取外部注释用于文件夹、资源、COBOL 等
|
||||
<li>修改配置:设置 -> 工具 -> // Show Comment Global/Project
|
||||
<li>修改配置:设置 -> 工具 -> // Show Comment App/Global/Project
|
||||
</ul>
|
||||
|
||||
<h3>外部注释</h3>
|
||||
@@ -93,13 +95,13 @@ Show doc comment at the Project view Tree, line End, json, other
|
||||
<li>我的情况:1993-11-03,软件工程师,广发银行编制,宅,LOLm,NS,看书,写文章,KTV,爬山,逛街
|
||||
<li>我的性格:ISFP(探险家 内向 实际 感性 随性)
|
||||
<li>希望对方:广东省,与家人关系好,爱笑甜美大眼睛
|
||||
<li>有兴趣请联系 1498425439@qq.com
|
||||
<li>有兴趣请联系 1498425439@qq.com,也欢迎反馈问题和需求
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
<h2>支持</h2>
|
||||
<ul>
|
||||
<li>如果对你有所帮助,别忘了给本项目
|
||||
<li>如果对你有所帮助,可以通过群或文章等形式分享给大家,在插件市场好评,或者给本项目
|
||||
<a href="https://github.com/LinWanCen/show-comment">GitHub</a>
|
||||
主页一个 Star,您的支持是项目前进的动力。
|
||||
</ul>
|
||||
@@ -115,6 +117,9 @@ Show doc comment at the Project view Tree, line End, json, other
|
||||
<depends optional="true" config-file="js.xml">JavaScript</depends>
|
||||
<depends optional="true" config-file="python.xml">com.intellij.modules.python</depends>
|
||||
<depends optional="true" config-file="go.xml">org.jetbrains.plugins.go</depends>
|
||||
<!-- old version -->
|
||||
<depends optional="true" config-file="rust.xml">org.rust.lang</depends>
|
||||
<depends optional="true" config-file="rust.xml">com.jetbrains.rust</depends>
|
||||
<!--suppress PluginXmlValidity, MybatisMapperXmlInspection -->
|
||||
<!--<depends optional="true" config-file="cs.xml">com.intellij.modules.rider</depends>-->
|
||||
|
||||
|
||||
5
src/main/resources/META-INF/rust.xml
Normal file
5
src/main/resources/META-INF/rust.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<idea-plugin>
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<editor.linePainter implementation="io.github.linwancen.plugin.show.lang.RustLangDoc"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
@@ -7,6 +7,8 @@ import io.github.linwancen.plugin.show.bean.LineInfo;
|
||||
import io.github.linwancen.plugin.show.lang.base.BaseLangDoc;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Doesn't work because I don't know how to get Reference for CSharp PsiElement
|
||||
* <br>https://intellij-support.jetbrains.com/hc/en-us/requests/4228491
|
||||
@@ -23,7 +25,7 @@ public class CsLineEnd extends BaseLangDoc {
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Class<? extends PsiElement> getRefClass() {
|
||||
return CSharpDummyNode.class;
|
||||
public @NotNull List<Class<? extends PsiElement>> getRefClass() {
|
||||
return List.of(CSharpDummyNode.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
// file tree doc is any where not doc comment
|
||||
|
||||
fn main() {
|
||||
my_fun()
|
||||
}
|
||||
|
||||
/// rust doc
|
||||
/// [`my_fun`]
|
||||
fn my_fun() {}
|
||||
Reference in New Issue
Block a user