feat(YamlLangDoc): support YAML | 支持 YAML
This commit is contained in:
@@ -15,6 +15,7 @@ Show doc comment in the Project view Tree, line End, json, other
|
||||
<li>Java, Kotlin, Groovy, Scala
|
||||
<li>C/C++/OC, Python, Go, Rust, Ruby
|
||||
<li>JS/TS, PHP, SQL
|
||||
<li>YAML/yml
|
||||
</ul>
|
||||
|
||||
<h4>English Note</h4>
|
||||
|
||||
@@ -30,6 +30,7 @@ intellij {
|
||||
// see https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#intellij-extension-plugins
|
||||
plugins = [
|
||||
'PsiViewer:201.6251.22-EAP-SNAPSHOT.3', // only for runIde when dev
|
||||
'org.jetbrains.plugins.yaml',
|
||||
'Pythonid:201.6668.121',
|
||||
'org.rust.lang:0.3.131.3366-201',
|
||||
'org.toml.lang:0.2.131.3366-201',
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
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.bean.SettingsInfo;
|
||||
import io.github.linwancen.plugin.show.lang.base.BaseLangDoc;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.yaml.YAMLLanguage;
|
||||
import org.jetbrains.yaml.psi.YAMLKeyValue;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class YamlLangDoc extends BaseLangDoc {
|
||||
|
||||
static {
|
||||
LANG_DOC_MAP.put(YAMLLanguage.INSTANCE.getID(), new YamlLangDoc());
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull List<Class<? extends PsiElement>> getRefClass() {
|
||||
return List.of(YAMLKeyValue.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean show(@NotNull LineInfo info) {
|
||||
return info.appSettings.showLineEndCommentYaml;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected <T extends SettingsInfo> String resolveDocPrint(@NotNull T info, @NotNull PsiElement resolve) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -29,10 +29,10 @@ public class AppSettingsComponent {
|
||||
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 ");
|
||||
private final JBCheckBox showLineEndCommentPhpBase = new JBCheckBox("// php ");
|
||||
private final JBCheckBox showLineEndCommentJs = new JBCheckBox(" JS ");
|
||||
private final JBCheckBox showLineEndCommentJsBase = new JBCheckBox("// JS ");
|
||||
private final JBCheckBox showLineEndCommentPhp = new JBCheckBox(" PHP ");
|
||||
private final JBCheckBox showLineEndCommentPhpBase = new JBCheckBox("// PHP ");
|
||||
private final JBCheckBox showLineEndCommentPy = new JBCheckBox(" Python ");
|
||||
private final JBCheckBox showLineEndCommentPyBase = new JBCheckBox("# Python ");
|
||||
private final JBCheckBox showLineEndCommentGo = new JBCheckBox(" Go ");
|
||||
@@ -41,8 +41,9 @@ public class AppSettingsComponent {
|
||||
private final JBCheckBox showLineEndCommentRubyBase = new JBCheckBox("// Ruby ");
|
||||
private final JBCheckBox showLineEndCommentCBase = new JBCheckBox("// C ");
|
||||
private final JBCheckBox showLineEndCommentSwiftBase = new JBCheckBox("// Swift ");
|
||||
private final JBCheckBox showLineEndCommentSql = new JBCheckBox(" sql ");
|
||||
private final JBCheckBox showLineEndCommentJson = new JBCheckBox(" json ");
|
||||
private final JBCheckBox showLineEndCommentSql = new JBCheckBox(" SQL ");
|
||||
private final JBCheckBox showLineEndCommentJson = new JBCheckBox(" JSON ");
|
||||
private final JBCheckBox showLineEndCommentYaml = new JBCheckBox(" YAML ");
|
||||
private final JBTextField lineTags = new JBTextField();
|
||||
private final JBCheckBox getToSet = new JBCheckBox("get --> set ");
|
||||
private final JBCheckBox fromNew = new JBCheckBox("java new ");
|
||||
@@ -90,7 +91,8 @@ public class AppSettingsComponent {
|
||||
|
||||
showLineEndCommentGo,
|
||||
showLineEndCommentSql,
|
||||
showLineEndCommentJson
|
||||
showLineEndCommentJson,
|
||||
showLineEndCommentYaml
|
||||
), 1)
|
||||
.addComponent(JPanelFactory.of(
|
||||
showLineEndCommentJsBase,
|
||||
@@ -359,6 +361,14 @@ public class AppSettingsComponent {
|
||||
showLineEndCommentJson.setSelected(newStatus);
|
||||
}
|
||||
|
||||
public boolean getShowLineEndCommentYaml() {
|
||||
return showLineEndCommentYaml.isSelected();
|
||||
}
|
||||
|
||||
public void setShowLineEndCommentYaml(boolean newStatus) {
|
||||
showLineEndCommentYaml.setSelected(newStatus);
|
||||
}
|
||||
|
||||
// endregion line end
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -63,6 +63,7 @@ public class AppSettingsConfigurable implements Configurable {
|
||||
modified |= mySettingsComponent.getShowLineEndCommentSwiftBase() != settings.showLineEndCommentSwiftBase;
|
||||
modified |= mySettingsComponent.getShowLineEndCommentSql() != settings.showLineEndCommentSql;
|
||||
modified |= mySettingsComponent.getShowLineEndCommentJson() != settings.showLineEndCommentJson;
|
||||
modified |= mySettingsComponent.getShowLineEndCommentYaml() != settings.showLineEndCommentYaml;
|
||||
|
||||
modified |= !mySettingsComponent.getTreeTags().equals(String.join("|", settings.treeTags));
|
||||
modified |= !mySettingsComponent.getLineTags().equals(String.join("|", settings.lineTags));
|
||||
@@ -112,6 +113,7 @@ public class AppSettingsConfigurable implements Configurable {
|
||||
settings.showLineEndCommentSwiftBase = mySettingsComponent.getShowLineEndCommentSwiftBase();
|
||||
settings.showLineEndCommentSql = mySettingsComponent.getShowLineEndCommentSql();
|
||||
settings.showLineEndCommentJson = mySettingsComponent.getShowLineEndCommentJson();
|
||||
settings.showLineEndCommentYaml = mySettingsComponent.getShowLineEndCommentYaml();
|
||||
|
||||
settings.treeTags = Splitter.on('|').splitToList(mySettingsComponent.getTreeTags()).toArray(new String[0]);
|
||||
settings.lineTags = Splitter.on('|').splitToList(mySettingsComponent.getLineTags()).toArray(new String[0]);
|
||||
@@ -164,6 +166,7 @@ public class AppSettingsConfigurable implements Configurable {
|
||||
mySettingsComponent.setShowLineEndCommentSwiftBase(settings.showLineEndCommentSwiftBase);
|
||||
mySettingsComponent.setShowLineEndCommentSql(settings.showLineEndCommentSql);
|
||||
mySettingsComponent.setShowLineEndCommentJson(settings.showLineEndCommentJson);
|
||||
mySettingsComponent.setShowLineEndCommentYaml(settings.showLineEndCommentYaml);
|
||||
|
||||
mySettingsComponent.setTreeTags(String.join("|", settings.treeTags));
|
||||
mySettingsComponent.setLineTags(String.join("|", settings.lineTags));
|
||||
|
||||
@@ -51,6 +51,7 @@ public class AppSettingsState implements PersistentStateComponent<AppSettingsSta
|
||||
public boolean showLineEndCommentSwiftBase = true;
|
||||
public boolean showLineEndCommentSql = true;
|
||||
public boolean showLineEndCommentJson = true;
|
||||
public boolean showLineEndCommentYaml = true;
|
||||
|
||||
@NotNull
|
||||
public String[] treeTags = {"author"};
|
||||
|
||||
@@ -13,6 +13,7 @@ Show doc comment in the Project view Tree, line End, json, other
|
||||
<li>Java, Kotlin, Groovy, Scala
|
||||
<li>C/C++/OC, Python, Go, Rust, Ruby
|
||||
<li>JS/TS, PHP, SQL
|
||||
<li>YAML/yml
|
||||
</ul>
|
||||
|
||||
<h4>English Note</h4>
|
||||
@@ -136,6 +137,7 @@ Show doc comment in the Project view Tree, line End, json, other
|
||||
<depends optional="true" config-file="ruby.xml">com.intellij.modules.ruby</depends>
|
||||
<depends optional="true" config-file="c.xml">com.intellij.modules.clion</depends>
|
||||
<depends optional="true" config-file="swift.xml">com.intellij.modules.swift.lang</depends>
|
||||
<depends optional="true" config-file="yaml.xml">org.jetbrains.plugins.yaml</depends>
|
||||
<!--<depends optional="true" config-file="cs.xml">com.intellij.modules.rider</depends>-->
|
||||
|
||||
<applicationListeners>
|
||||
|
||||
5
src/main/resources/META-INF/yaml.xml
Normal file
5
src/main/resources/META-INF/yaml.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<idea-plugin>
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<editor.linePainter implementation="io.github.linwancen.plugin.show.lang.YamlLangDoc"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
Reference in New Issue
Block a user