2.03 support all JetBrains IDE SQL, JavaScript, Python, Golang, Kotlin; add doc live-templates | 支持所有 JetBrains 软件和主流语言; 增加输入 doc / docc 等生成 /** */
This commit is contained in:
13
src/test/java/io/github/linwancen/plugin/show/demo/Cs.cs
Normal file
13
src/test/java/io/github/linwancen/plugin/show/demo/Cs.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace ConsoleApplication1
|
||||
{
|
||||
/*
|
||||
* Program
|
||||
*/
|
||||
internal class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
var program = new Program();
|
||||
}
|
||||
}
|
||||
}
|
||||
76
src/test/java/io/github/linwancen/plugin/show/demo/Golang.go
Normal file
76
src/test/java/io/github/linwancen/plugin/show/demo/Golang.go
Normal file
@@ -0,0 +1,76 @@
|
||||
// Copyright
|
||||
|
||||
// go package
|
||||
package main
|
||||
|
||||
// doc
|
||||
func main() {
|
||||
line(val)
|
||||
line(val1)
|
||||
line(value)
|
||||
|
||||
t := &Class{}
|
||||
line2(t.a)
|
||||
line2(t.b)
|
||||
|
||||
line(t)
|
||||
multiLine(t)
|
||||
lineBlock(t)
|
||||
block(t)
|
||||
|
||||
// t
|
||||
a := &Class{}
|
||||
line(a)
|
||||
line(multiLine(block(t)))
|
||||
}
|
||||
|
||||
// const
|
||||
const val = ""
|
||||
|
||||
const (
|
||||
// val1
|
||||
val1 = ""
|
||||
)
|
||||
|
||||
// var
|
||||
var value *Class
|
||||
|
||||
// First Class
|
||||
type Class struct {
|
||||
// a
|
||||
a *Class2
|
||||
b *Class2 // b
|
||||
}
|
||||
|
||||
// Class2
|
||||
type Class2 struct{}
|
||||
|
||||
// line
|
||||
func line(t *Class) *Class {
|
||||
return t
|
||||
}
|
||||
|
||||
// line2
|
||||
func line2(t *Class2) *Class2 {
|
||||
return t
|
||||
}
|
||||
|
||||
/*** lineBlock */
|
||||
func lineBlock(t *Class) *Class {
|
||||
return t
|
||||
}
|
||||
|
||||
/*****
|
||||
***** block
|
||||
*****/
|
||||
func block(t *Class) *Class {
|
||||
return t
|
||||
}
|
||||
|
||||
// other
|
||||
|
||||
// 1
|
||||
// 2
|
||||
func multiLine(t *Class) *Class {
|
||||
return t
|
||||
}
|
||||
25
src/test/java/io/github/linwancen/plugin/show/demo/HTML.html
Normal file
25
src/test/java/io/github/linwancen/plugin/show/demo/HTML.html
Normal file
@@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
<script type="javascript">
|
||||
lineBlock(isNotDoc)
|
||||
lineBlock(docVal)
|
||||
|
||||
// isNotDoc
|
||||
const isNotDoc = ""
|
||||
|
||||
/** docVal */
|
||||
const docVal = ""
|
||||
|
||||
/*** lineBlock ***/
|
||||
function lineBlock(t) {
|
||||
return t
|
||||
}
|
||||
</script>
|
||||
</html>
|
||||
@@ -0,0 +1,23 @@
|
||||
|
||||
lineBlock(isNotDoc)
|
||||
lineBlock(docVal)
|
||||
block()
|
||||
|
||||
// isNotDoc
|
||||
const isNotDoc = ""
|
||||
|
||||
/** docVal */
|
||||
const docVal = ""
|
||||
|
||||
/*** lineBlock ***/
|
||||
function lineBlock(t) {
|
||||
return t
|
||||
}
|
||||
|
||||
/*****
|
||||
***** 1
|
||||
***** 2
|
||||
*****/
|
||||
function block(t) {
|
||||
return t
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
|
||||
obj.isA(obj.getB())
|
||||
obj.setA(obj.getB())
|
||||
obj.setB(obj.a)
|
||||
|
||||
/** A */
|
||||
let a = obj.isA(obj.getA())
|
||||
/** B */
|
||||
let b = obj
|
||||
.setA(obj.getA())
|
||||
/** B */
|
||||
let b = obj
|
||||
.setA(
|
||||
obj.getB())
|
||||
|
||||
/** obj1 */
|
||||
let obj = {
|
||||
/** a */
|
||||
"a":"A",
|
||||
/** b */
|
||||
"b":"B",
|
||||
/** sub */
|
||||
"sub":{
|
||||
/** subKey */
|
||||
"subKey":"subVal"
|
||||
},
|
||||
/** isA */
|
||||
isA: function (t) {
|
||||
return t
|
||||
},
|
||||
/** setA */
|
||||
setA: function (t) {
|
||||
return t
|
||||
},
|
||||
/** getB */
|
||||
getB: function (t) {
|
||||
return t
|
||||
},
|
||||
/** setB */
|
||||
setB: function (t) {
|
||||
return t
|
||||
},
|
||||
}
|
||||
37
src/test/java/io/github/linwancen/plugin/show/demo/Python.py
Normal file
37
src/test/java/io/github/linwancen/plugin/show/demo/Python.py
Normal file
@@ -0,0 +1,37 @@
|
||||
# Copyright
|
||||
|
||||
"""
|
||||
This module provides Python Demo.
|
||||
"""
|
||||
|
||||
# VAL1
|
||||
VAL = ""
|
||||
|
||||
|
||||
# Type1
|
||||
class Type:
|
||||
# Type init
|
||||
def __init__(self):
|
||||
pass
|
||||
# field1
|
||||
field = ""
|
||||
|
||||
|
||||
# line1
|
||||
def line():
|
||||
print()
|
||||
|
||||
|
||||
# 1
|
||||
# 2
|
||||
def multi_line():
|
||||
print()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print VAL
|
||||
line()
|
||||
multi_line()
|
||||
t1 = Type
|
||||
t2 = Type()
|
||||
print t2.field
|
||||
@@ -1,5 +1,5 @@
|
||||
KEY = '1' 字典1
|
||||
KEY = '2' 字典2
|
||||
KEY = '1' 字典1 )
|
||||
KEY = '2' 字典2 )
|
||||
HELLO-WORLD 你好世界
|
||||
B001-A 程序A
|
||||
A a
|
||||
|
||||
|
@@ -4,13 +4,17 @@ import io.github.linwancen.plugin.show.demo.java.obj.Child;
|
||||
import io.github.linwancen.plugin.show.demo.java.obj.Face;
|
||||
import io.github.linwancen.plugin.show.demo.java.obj.Parent;
|
||||
|
||||
/**
|
||||
* @author lin
|
||||
*/
|
||||
public class Call extends Parent {
|
||||
public static void call() {
|
||||
new Call();
|
||||
Child child = new Child(true);
|
||||
Parent parentMethod = child.parentMethod();
|
||||
Face faceMethod = child.faceMethod(child);
|
||||
boolean is = child.isBool();
|
||||
Child get = child.getField();
|
||||
child.setField(new Child(true)); // field
|
||||
child.setField(new Child(true));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package io.github.linwancen.plugin.show.demo.java;
|
||||
|
||||
/**
|
||||
* InDoc
|
||||
*
|
||||
* {@link InDoc}
|
||||
* {@link InDoc#field}
|
||||
* {@link InDoc#method1}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package io.github.linwancen.plugin.show.demo.java
|
||||
|
||||
import io.github.linwancen.plugin.show.demo.java.obj.Child
|
||||
import io.github.linwancen.plugin.show.demo.java.obj.Parent
|
||||
|
||||
/**
|
||||
* @author l
|
||||
*/
|
||||
object Kotlin : Parent() {
|
||||
/** call */
|
||||
fun call() {
|
||||
Kotlin()
|
||||
abc()
|
||||
val child = Child(true)
|
||||
val parentMethod = child.parentMethod()
|
||||
val faceMethod = child.faceMethod(child)
|
||||
val `is` = child.isBool // NotAutoComment
|
||||
val get = child.getField()
|
||||
child.setField(Child(true))
|
||||
}
|
||||
|
||||
private operator fun invoke() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
/**
|
||||
* abc
|
||||
*/
|
||||
private fun abc() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package io.github.linwancen.plugin.show.demo.java;
|
||||
|
||||
public class Param {
|
||||
/**
|
||||
* @param a a
|
||||
* @param b b
|
||||
*/
|
||||
public static void func(String a, String b) {
|
||||
System.out.println(a);
|
||||
System.out.println(b);
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,9 @@ public class Ref implements Face {
|
||||
.faceMethod(face1 -> Child::setFun);
|
||||
}
|
||||
|
||||
/**
|
||||
* do not show this after @Override
|
||||
*/
|
||||
@Override
|
||||
public Face faceMethod(Face face) {
|
||||
return null;
|
||||
|
||||
@@ -22,8 +22,8 @@ public class Child extends Parent implements Face {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** String fun */
|
||||
public String fun;
|
||||
/** only Name fun */
|
||||
public Face fun;
|
||||
|
||||
public static Face setFun(Face face) {
|
||||
return null;
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
select * from NewTable where Column1 is not null ;
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.github.linwancen.plugin.show.doc;
|
||||
package io.github.linwancen.plugin.show.lang.base;
|
||||
|
||||
import io.github.linwancen.plugin.show.lang.base.DocFilter;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -7,9 +8,9 @@ import org.junit.jupiter.api.Test;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @see PsiDocToStrDoc
|
||||
* @see DocFilter
|
||||
*/
|
||||
class PsiDocToStrDocTest {
|
||||
class DocFilterTest {
|
||||
|
||||
public static final String[] STRS = {
|
||||
"english. next",
|
||||
@@ -31,7 +32,7 @@ class PsiDocToStrDocTest {
|
||||
};
|
||||
|
||||
/**
|
||||
* @see PsiDocToStrDoc#getDoc
|
||||
* @see DocFilter#filterDoc
|
||||
*/
|
||||
@Test
|
||||
void testGetDoc() {
|
||||
@@ -39,7 +40,7 @@ class PsiDocToStrDocTest {
|
||||
Pattern p = PATTERNS[pi];
|
||||
for (int si = 0; si < STRS.length; si++) {
|
||||
String s = STRS[si];
|
||||
@Nullable String doc = PsiDocToStrDoc.getDoc(s, p);
|
||||
@Nullable String doc = DocFilter.filterDoc(s, p);
|
||||
String pattern = p.pattern();
|
||||
System.out.println("(" + s + ", " + pattern + "): " + doc);
|
||||
if (pi < 2) {
|
||||
@@ -1,4 +1,4 @@
|
||||
package io.github.linwancen.plugin.show.line;
|
||||
package io.github.linwancen.plugin.show.lang.base;
|
||||
|
||||
|
||||
import groovy.json.JsonOutput;
|
||||
@@ -9,9 +9,9 @@ import java.util.function.BiPredicate;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @see SkipUtils
|
||||
* @see DocSkip
|
||||
*/
|
||||
class PsiClassSkipTest {
|
||||
class DocSkipTest {
|
||||
|
||||
private static final boolean o = true;
|
||||
private static final boolean x = false;
|
||||
@@ -66,7 +66,7 @@ class PsiClassSkipTest {
|
||||
Pattern include = includes[includeIndex];
|
||||
for (int excludeIndex = 0, excludesLength = excludes.length; excludeIndex < excludesLength; excludeIndex++) {
|
||||
Pattern exclude = excludes[excludeIndex];
|
||||
boolean isSkip = SkipUtils.skipText(name, include, exclude);
|
||||
boolean isSkip = DocSkip.skipText(name, include, exclude);
|
||||
String tip =
|
||||
name + "==" + JsonOutput.toJson(include) + "!=" + JsonOutput.toJson(exclude) + "=>" + isSkip;
|
||||
System.out.println(tip);
|
||||
@@ -86,7 +86,7 @@ class PsiClassSkipTest {
|
||||
{x, o, o}, // {"io"},
|
||||
{o, o, o}, // {"java", "io"},
|
||||
};
|
||||
loopTest(SkipUtils::include, results);
|
||||
loopTest(DocSkip::include, results);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -98,7 +98,7 @@ class PsiClassSkipTest {
|
||||
{x, o, o}, // {"io"},
|
||||
{o, o, o}, // {"java", "io"},
|
||||
};
|
||||
loopTest(SkipUtils::exclude, results);
|
||||
loopTest(DocSkip::exclude, results);
|
||||
}
|
||||
|
||||
private void loopTest(BiPredicate<String, Pattern> biPredicate, boolean[][] results) {
|
||||
Reference in New Issue
Block a user