2019-04-28 21:19:54 -06:00
|
|
|
package snippets
|
|
|
|
|
|
|
|
func foo(i int, b bool) {} //@item(snipFoo, "foo(i int, b bool)", "", "func")
|
|
|
|
func bar(fn func()) func() {} //@item(snipBar, "bar(fn func())", "", "func")
|
|
|
|
|
|
|
|
type Foo struct {
|
|
|
|
Bar int //@item(snipFieldBar, "Bar", "int", "field")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (Foo) Baz() func() {} //@item(snipMethodBaz, "Baz()", "func()", "field")
|
|
|
|
|
|
|
|
func _() {
|
2019-05-13 14:49:29 -06:00
|
|
|
f //@snippet(" //", snipFoo, "foo(${1})", "foo(${1:i int}, ${2:b bool})")
|
2019-04-28 21:19:54 -06:00
|
|
|
|
2019-05-13 14:49:29 -06:00
|
|
|
bar //@snippet(" //", snipBar, "bar(${1})", "bar(${1:fn func()})")
|
2019-04-28 21:19:54 -06:00
|
|
|
|
2019-05-13 14:49:29 -06:00
|
|
|
bar(nil) //@snippet("(", snipBar, "bar", "bar")
|
|
|
|
bar(ba) //@snippet(")", snipBar, "bar(${1})", "bar(${1:fn func()})")
|
2019-04-28 21:19:54 -06:00
|
|
|
var f Foo
|
2019-05-13 14:49:29 -06:00
|
|
|
bar(f.Ba) //@snippet(")", snipMethodBaz, "Baz()", "Baz()")
|
2019-05-13 21:09:27 -06:00
|
|
|
(bar)(nil) //@snippet(")", snipBar, "bar(${1})", "bar(${1:fn func()})")
|
|
|
|
(f.Ba)() //@snippet(")", snipMethodBaz, "Baz()", "Baz()")
|
2019-04-28 21:19:54 -06:00
|
|
|
|
|
|
|
Foo{
|
2019-05-13 14:49:29 -06:00
|
|
|
B //@snippet(" //", snipFieldBar, "Bar: ${1},", "Bar: ${1:int},")
|
2019-04-28 21:19:54 -06:00
|
|
|
}
|
|
|
|
|
2019-05-13 14:49:29 -06:00
|
|
|
Foo{B} //@snippet("}", snipFieldBar, "Bar: ${1}", "Bar: ${1:int}")
|
2019-04-28 21:19:54 -06:00
|
|
|
Foo{} //@snippet("}", snipFieldBar, "Bar: ${1}", "Bar: ${1:int}")
|
|
|
|
|
2019-05-13 14:49:29 -06:00
|
|
|
Foo{Foo{}.B} //@snippet("} ", snipFieldBar, "Bar", "Bar")
|
2019-04-28 21:19:54 -06:00
|
|
|
}
|