diff options
Diffstat (limited to 'internal/lsp/testdata')
376 files changed, 0 insertions, 12170 deletions
diff --git a/internal/lsp/testdata/%percent/perc%ent.go b/internal/lsp/testdata/%percent/perc%ent.go deleted file mode 100644 index 93b5e5570..000000000 --- a/internal/lsp/testdata/%percent/perc%ent.go +++ /dev/null @@ -1 +0,0 @@ -package percent diff --git a/internal/lsp/testdata/addimport/addimport.go.golden b/internal/lsp/testdata/addimport/addimport.go.golden deleted file mode 100644 index 9605aa6f9..000000000 --- a/internal/lsp/testdata/addimport/addimport.go.golden +++ /dev/null @@ -1,7 +0,0 @@ --- addimport -- -package addimport //@addimport("", "bytes") - -import "bytes" - -func main() {} - diff --git a/internal/lsp/testdata/addimport/addimport.go.in b/internal/lsp/testdata/addimport/addimport.go.in deleted file mode 100644 index 07b454f52..000000000 --- a/internal/lsp/testdata/addimport/addimport.go.in +++ /dev/null @@ -1,3 +0,0 @@ -package addimport //@addimport("", "bytes") - -func main() {} diff --git a/internal/lsp/testdata/address/address.go b/internal/lsp/testdata/address/address.go deleted file mode 100644 index 3f1c2fa8d..000000000 --- a/internal/lsp/testdata/address/address.go +++ /dev/null @@ -1,78 +0,0 @@ -package address - -func wantsPtr(*int) {} -func wantsVariadicPtr(...*int) {} - -func wantsVariadic(...int) {} - -type foo struct{ c int } //@item(addrFieldC, "c", "int", "field") - -func _() { - var ( - a string //@item(addrA, "a", "string", "var") - b int //@item(addrB, "b", "int", "var") - ) - - wantsPtr() //@rank(")", addrB, addrA),snippet(")", addrB, "&b", "&b") - wantsPtr(&b) //@snippet(")", addrB, "b", "b") - - wantsVariadicPtr() //@rank(")", addrB, addrA),snippet(")", addrB, "&b", "&b") - - var s foo - s.c //@item(addrDeepC, "s.c", "int", "field") - wantsPtr() //@snippet(")", addrDeepC, "&s.c", "&s.c") - wantsPtr(s) //@snippet(")", addrDeepC, "&s.c", "&s.c") - wantsPtr(&s) //@snippet(")", addrDeepC, "s.c", "s.c") - - // don't add "&" in item (it gets added as an additional edit) - wantsPtr(&s.c) //@snippet(")", addrFieldC, "c", "c") - - // check dereferencing as well - var c *int //@item(addrCPtr, "c", "*int", "var") - var _ int = _ //@rank("_ //", addrCPtr, addrA),snippet("_ //", addrCPtr, "*c", "*c") - - wantsVariadic() //@rank(")", addrCPtr, addrA),snippet(")", addrCPtr, "*c", "*c") - - var d **int //@item(addrDPtr, "d", "**int", "var") - var _ int = _ //@rank("_ //", addrDPtr, addrA),snippet("_ //", addrDPtr, "**d", "**d") - - type namedPtr *int - var np namedPtr //@item(addrNamedPtr, "np", "namedPtr", "var") - - var _ int = _ //@rank("_ //", addrNamedPtr, addrA) - - // don't get tripped up by recursive pointer type - type dontMessUp *dontMessUp - var dmu *dontMessUp //@item(addrDMU, "dmu", "*dontMessUp", "var") - - var _ int = dmu //@complete(" //", addrDMU) -} - -func (f foo) ptr() *foo { return &f } - -func _() { - getFoo := func() foo { return foo{} } - - // not addressable - getFoo().c //@item(addrGetFooC, "getFoo().c", "int", "field") - - // addressable - getFoo().ptr().c //@item(addrGetFooPtrC, "getFoo().ptr().c", "int", "field") - - wantsPtr() //@rank(addrGetFooPtrC, addrGetFooC),snippet(")", addrGetFooPtrC, "&getFoo().ptr().c", "&getFoo().ptr().c") - wantsPtr(&g) //@rank(addrGetFooPtrC, addrGetFooC),snippet(")", addrGetFooPtrC, "getFoo().ptr().c", "getFoo().ptr().c") -} - -type nested struct { - f foo -} - -func _() { - getNested := func() nested { return nested{} } - - getNested().f.c //@item(addrNestedC, "getNested().f.c", "int", "field") - getNested().f.ptr().c //@item(addrNestedPtrC, "getNested().f.ptr().c", "int", "field") - - // addrNestedC is not addressable, so rank lower - wantsPtr(getNestedfc) //@fuzzy(")", addrNestedPtrC, addrNestedC) -} diff --git a/internal/lsp/testdata/analyzer/bad_test.go b/internal/lsp/testdata/analyzer/bad_test.go deleted file mode 100644 index c819cbc01..000000000 --- a/internal/lsp/testdata/analyzer/bad_test.go +++ /dev/null @@ -1,18 +0,0 @@ -package analyzer - -import ( - "fmt" - "sync" - "testing" -) - -func Testbad(t *testing.T) { //@diag("", "tests", "Testbad has malformed name: first letter after 'Test' must not be lowercase", "warning") - var x sync.Mutex - _ = x //@diag("x", "copylocks", "assignment copies lock value to _: sync.Mutex", "warning") - - printfWrapper("%s") //@diag(re`printfWrapper\(.*\)`, "printf", "golang.org/x/tools/internal/lsp/analyzer.printfWrapper format %s reads arg #1, but call has 0 args", "warning") -} - -func printfWrapper(format string, args ...interface{}) { - fmt.Printf(format, args...) -} diff --git a/internal/lsp/testdata/anon/anon.go.in b/internal/lsp/testdata/anon/anon.go.in deleted file mode 100644 index 36611b268..000000000 --- a/internal/lsp/testdata/anon/anon.go.in +++ /dev/null @@ -1,23 +0,0 @@ -package anon - -func _() { - for _, _ := range []struct { - i, j int //@item(anonI, "i", "int", "field"),item(anonJ, "j", "int", "field") - }{ - { - i: 1, - //@complete("", anonJ) - }, - { - //@complete("", anonI, anonJ) - }, - } { - continue - } - - s := struct{ f int }{ } //@item(anonF, "f", "int", "field"),item(structS, "s", "struct{...}", "var"),complete(" }", anonF) - - _ = map[struct{ x int }]int{ //@item(anonX, "x", "int", "field") - struct{ x int }{ }: 1, //@complete(" }", anonX, structS) - } -} diff --git a/internal/lsp/testdata/append/append.go b/internal/lsp/testdata/append/append.go deleted file mode 100644 index 2880e59db..000000000 --- a/internal/lsp/testdata/append/append.go +++ /dev/null @@ -1,38 +0,0 @@ -package append - -func foo([]string) {} -func bar(...string) {} - -func _() { - var ( - aInt []int //@item(appendInt, "aInt", "[]int", "var") - aStrings []string //@item(appendStrings, "aStrings", "[]string", "var") - aString string //@item(appendString, "aString", "string", "var") - ) - - append(aStrings, a) //@rank(")", appendString, appendInt) - var _ interface{} = append(aStrings, a) //@rank(")", appendString, appendInt) - var _ []string = append(oops, a) //@rank(")", appendString, appendInt) - - foo(append()) //@rank("))", appendStrings, appendInt),rank("))", appendStrings, appendString) - foo(append([]string{}, a)) //@rank("))", appendStrings, appendInt),rank("))", appendString, appendInt),snippet("))", appendStrings, "aStrings...", "aStrings...") - foo(append([]string{}, "", a)) //@rank("))", appendString, appendInt),rank("))", appendString, appendStrings) - - // Don't add "..." to append() argument. - bar(append()) //@snippet("))", appendStrings, "aStrings", "aStrings") - - type baz struct{} - baz{} //@item(appendBazLiteral, "baz{}", "", "var") - var bazzes []baz //@item(appendBazzes, "bazzes", "[]baz", "var") - var bazzy baz //@item(appendBazzy, "bazzy", "baz", "var") - bazzes = append(bazzes, ba) //@rank(")", appendBazzy, appendBazLiteral, appendBazzes) - - var b struct{ b []baz } - b.b //@item(appendNestedBaz, "b.b", "[]baz", "field") - b.b = append(b.b, b) //@rank(")", appendBazzy, appendBazLiteral, appendNestedBaz) - - var aStringsPtr *[]string //@item(appendStringsPtr, "aStringsPtr", "*[]string", "var") - foo(append([]string{}, a)) //@snippet("))", appendStringsPtr, "*aStringsPtr...", "*aStringsPtr...") - - foo(append([]string{}, *a)) //@snippet("))", appendStringsPtr, "aStringsPtr...", "aStringsPtr...") -} diff --git a/internal/lsp/testdata/append/append2.go.in b/internal/lsp/testdata/append/append2.go.in deleted file mode 100644 index 15bd357b2..000000000 --- a/internal/lsp/testdata/append/append2.go.in +++ /dev/null @@ -1,5 +0,0 @@ -package append - -func _() { - _ = append(a, struct) //@complete(")") -}
\ No newline at end of file diff --git a/internal/lsp/testdata/arraytype/array_type.go.in b/internal/lsp/testdata/arraytype/array_type.go.in deleted file mode 100644 index 7e9a96f7b..000000000 --- a/internal/lsp/testdata/arraytype/array_type.go.in +++ /dev/null @@ -1,48 +0,0 @@ -package arraytype - -import ( - "golang.org/x/tools/internal/lsp/foo" -) - -func _() { - var ( - val string //@item(atVal, "val", "string", "var") - ) - - [] //@complete(" //", PackageFoo) - - []val //@complete(" //") - - []foo.StructFoo //@complete(" //", StructFoo) - - []foo.StructFoo(nil) //@complete("(", StructFoo) - - []*foo.StructFoo //@complete(" //", StructFoo) - - [...]foo.StructFoo //@complete(" //", StructFoo) - - [2][][4]foo.StructFoo //@complete(" //", StructFoo) - - []struct { f []foo.StructFoo } //@complete(" }", StructFoo) -} - -func _() { - type myInt int //@item(atMyInt, "myInt", "int", "type") - - var mark []myInt //@item(atMark, "mark", "[]myInt", "var") - - var s []myInt //@item(atS, "s", "[]myInt", "var") - s = []m //@complete(" //", atMyInt) - s = [] //@complete(" //", atMyInt, PackageFoo) - - var a [1]myInt - a = [1]m //@complete(" //", atMyInt) - - var ds [][]myInt - ds = [][]m //@complete(" //", atMyInt) -} - -func _() { - var b [0]byte //@item(atByte, "b", "[0]byte", "var") - var _ []byte = b //@snippet(" //", atByte, "b[:]", "b[:]") -} diff --git a/internal/lsp/testdata/assign/assign.go.in b/internal/lsp/testdata/assign/assign.go.in deleted file mode 100644 index 8c00ae9e0..000000000 --- a/internal/lsp/testdata/assign/assign.go.in +++ /dev/null @@ -1,26 +0,0 @@ -package assign - -import "golang.org/x/tools/internal/lsp/assign/internal/secret" - -func _() { - secret.Hello() - var ( - myInt int //@item(assignInt, "myInt", "int", "var") - myStr string //@item(assignStr, "myStr", "string", "var") - ) - - var _ string = my //@rank(" //", assignStr, assignInt) - var _ string = //@rank(" //", assignStr, assignInt) -} - -func _() { - var a string = a //@complete(" //") -} - -func _() { - fooBar := fooBa //@complete(" //"),item(assignFooBar, "fooBar", "", "var") - abc, fooBar := 123, fooBa //@complete(" //", assignFooBar) - { - fooBar := fooBa //@complete(" //", assignFooBar) - } -} diff --git a/internal/lsp/testdata/assign/internal/secret/secret.go b/internal/lsp/testdata/assign/internal/secret/secret.go deleted file mode 100644 index 5ee1554df..000000000 --- a/internal/lsp/testdata/assign/internal/secret/secret.go +++ /dev/null @@ -1,3 +0,0 @@ -package secret - -func Hello() {}
\ No newline at end of file diff --git a/internal/lsp/testdata/bad/bad0.go b/internal/lsp/testdata/bad/bad0.go deleted file mode 100644 index 36a4e6b95..000000000 --- a/internal/lsp/testdata/bad/bad0.go +++ /dev/null @@ -1,23 +0,0 @@ -// +build go1.11 - -package bad - -import _ "golang.org/x/tools/internal/lsp/assign/internal/secret" //@diag("\"golang.org/x/tools/internal/lsp/assign/internal/secret\"", "compiler", "could not import golang.org/x/tools/internal/lsp/assign/internal/secret (invalid use of internal package golang.org/x/tools/internal/lsp/assign/internal/secret)", "error") - -func stuff() { //@item(stuff, "stuff", "func()", "func") - x := "heeeeyyyy" - random2(x) //@diag("x", "compiler", "cannot use x (variable of type string) as int value in argument to random2", "error") - random2(1) //@complete("dom", random, random2, random3) - y := 3 //@diag("y", "compiler", "y declared but not used", "error") -} - -type bob struct { //@item(bob, "bob", "struct{...}", "struct") - x int -} - -func _() { - var q int - _ = &bob{ - f: q, //@diag("f: q", "compiler", "unknown field f in struct literal", "error") - } -} diff --git a/internal/lsp/testdata/bad/bad1.go b/internal/lsp/testdata/bad/bad1.go deleted file mode 100644 index 512f2d986..000000000 --- a/internal/lsp/testdata/bad/bad1.go +++ /dev/null @@ -1,33 +0,0 @@ -// +build go1.11 - -package bad - -// See #36637 -type stateFunc func() stateFunc //@item(stateFunc, "stateFunc", "func() stateFunc", "type") - -var a unknown //@item(global_a, "a", "unknown", "var"),diag("unknown", "compiler", "undeclared name: unknown", "error") - -func random() int { //@item(random, "random", "func() int", "func") - //@complete("", global_a, bob, random, random2, random3, stateFunc, stuff) - return 0 -} - -func random2(y int) int { //@item(random2, "random2", "func(y int) int", "func"),item(bad_y_param, "y", "int", "var") - x := 6 //@item(x, "x", "int", "var"),diag("x", "compiler", "x declared but not used", "error") - var q blah //@item(q, "q", "blah", "var"),diag("q", "compiler", "q declared but not used", "error"),diag("blah", "compiler", "undeclared name: blah", "error") - var t **blob //@item(t, "t", "**blob", "var"),diag("t", "compiler", "t declared but not used", "error"),diag("blob", "compiler", "undeclared name: blob", "error") - //@complete("", q, t, x, bad_y_param, global_a, bob, random, random2, random3, stateFunc, stuff) - - return y -} - -func random3(y ...int) { //@item(random3, "random3", "func(y ...int)", "func"),item(y_variadic_param, "y", "[]int", "var") - //@complete("", y_variadic_param, global_a, bob, random, random2, random3, stateFunc, stuff) - - var ch chan (favType1) //@item(ch, "ch", "chan (favType1)", "var"),diag("ch", "compiler", "ch declared but not used", "error"),diag("favType1", "compiler", "undeclared name: favType1", "error") - var m map[keyType]int //@item(m, "m", "map[keyType]int", "var"),diag("m", "compiler", "m declared but not used", "error"),diag("keyType", "compiler", "undeclared name: keyType", "error") - var arr []favType2 //@item(arr, "arr", "[]favType2", "var"),diag("arr", "compiler", "arr declared but not used", "error"),diag("favType2", "compiler", "undeclared name: favType2", "error") - var fn1 func() badResult //@item(fn1, "fn1", "func() badResult", "var"),diag("fn1", "compiler", "fn1 declared but not used", "error"),diag("badResult", "compiler", "undeclared name: badResult", "error") - var fn2 func(badParam) //@item(fn2, "fn2", "func(badParam)", "var"),diag("fn2", "compiler", "fn2 declared but not used", "error"),diag("badParam", "compiler", "undeclared name: badParam", "error") - //@complete("", arr, ch, fn1, fn2, m, y_variadic_param, global_a, bob, random, random2, random3, stateFunc, stuff) -} diff --git a/internal/lsp/testdata/badstmt/badstmt.go.in b/internal/lsp/testdata/badstmt/badstmt.go.in deleted file mode 100644 index 5a5607910..000000000 --- a/internal/lsp/testdata/badstmt/badstmt.go.in +++ /dev/null @@ -1,26 +0,0 @@ -package badstmt - -import ( - "golang.org/x/tools/internal/lsp/foo" -) - -func _() { - defer foo.F //@complete(" //", Foo),diag(" //", "syntax", "function must be invoked in defer statement", "error") - y := 1 - defer foo.F //@complete(" //", Foo) -} - -func _() { - switch true { - case true: - go foo.F //@complete(" //", Foo) - } -} - -func _() { - defer func() { - foo.F //@complete(" //", Foo),snippet(" //", Foo, "Foo()", "Foo()") - - foo. //@rank(" //", Foo) - } -} diff --git a/internal/lsp/testdata/badstmt/badstmt_2.go.in b/internal/lsp/testdata/badstmt/badstmt_2.go.in deleted file mode 100644 index f754b46aa..000000000 --- a/internal/lsp/testdata/badstmt/badstmt_2.go.in +++ /dev/null @@ -1,9 +0,0 @@ -package badstmt - -import ( - "golang.org/x/tools/internal/lsp/foo" -) - -func _() { - defer func() { foo. } //@rank(" }", Foo) -} diff --git a/internal/lsp/testdata/badstmt/badstmt_3.go.in b/internal/lsp/testdata/badstmt/badstmt_3.go.in deleted file mode 100644 index be774e84b..000000000 --- a/internal/lsp/testdata/badstmt/badstmt_3.go.in +++ /dev/null @@ -1,9 +0,0 @@ -package badstmt - -import ( - "golang.org/x/tools/internal/lsp/foo" -) - -func _() { - go foo. //@rank(" //", Foo, IntFoo),snippet(" //", Foo, "Foo()", "Foo()") -} diff --git a/internal/lsp/testdata/badstmt/badstmt_4.go.in b/internal/lsp/testdata/badstmt/badstmt_4.go.in deleted file mode 100644 index a9b46fb02..000000000 --- a/internal/lsp/testdata/badstmt/badstmt_4.go.in +++ /dev/null @@ -1,11 +0,0 @@ -package badstmt - -import ( - "golang.org/x/tools/internal/lsp/foo" -) - -func _() { - go func() { - defer foo. //@rank(" //", Foo, IntFoo) - } -} diff --git a/internal/lsp/testdata/bar/bar.go.in b/internal/lsp/testdata/bar/bar.go.in deleted file mode 100644 index c0f4b4c45..000000000 --- a/internal/lsp/testdata/bar/bar.go.in +++ /dev/null @@ -1,47 +0,0 @@ -// +build go1.11 - -package bar - -import ( - "golang.org/x/tools/internal/lsp/foo" //@item(foo, "foo", "\"golang.org/x/tools/internal/lsp/foo\"", "package") -) - -func helper(i foo.IntFoo) {} //@item(helper, "helper", "func(i foo.IntFoo)", "func") - -func _() { - help //@complete("l", helper) - _ = foo.StructFoo{} //@complete("S", IntFoo, StructFoo) -} - -// Bar is a function. -func Bar() { //@item(Bar, "Bar", "func()", "func", "Bar is a function.") - foo.Foo() //@complete("F", Foo, IntFoo, StructFoo) - var _ foo.IntFoo //@complete("I", IntFoo, StructFoo) - foo.() //@complete("(", Foo, IntFoo, StructFoo) -} - -func _() { - var Valentine int //@item(Valentine, "Valentine", "int", "var") - - _ = foo.StructFoo{ - Valu //@complete(" //", Value) - } - _ = foo.StructFoo{ - Va //@complete("a", Value, Valentine) - } - _ = foo.StructFoo{ - Value: 5, //@complete("a", Value) - } - _ = foo.StructFoo{ - //@complete("", Value, Valentine, foo, helper, Bar) - } - _ = foo.StructFoo{ - Value: Valen //@complete("le", Valentine) - } - _ = foo.StructFoo{ - Value: //@complete(" //", Valentine, foo, helper, Bar) - } - _ = foo.StructFoo{ - Value: //@complete(" ", Valentine, foo, helper, Bar) - } -} diff --git a/internal/lsp/testdata/basiclit/basiclit.go b/internal/lsp/testdata/basiclit/basiclit.go deleted file mode 100644 index 9829003d3..000000000 --- a/internal/lsp/testdata/basiclit/basiclit.go +++ /dev/null @@ -1,56 +0,0 @@ -package basiclit - -func _() { - var a int // something for lexical completions - - _ = "hello." //@complete(".") - - _ = 1 //@complete(" //") - - _ = 1. //@complete(".") - - _ = 'a' //@complete("' ") - - _ = 'a' //@hover("'a'", "'a', U+0061, LATIN SMALL LETTER A") - _ = 0x61 //@hover("0x61", "'a', U+0061, LATIN SMALL LETTER A") - - _ = '\u2211' //@hover("'\\u2211'", "'∑', U+2211, N-ARY SUMMATION") - _ = 0x2211 //@hover("0x2211", "'∑', U+2211, N-ARY SUMMATION") - _ = "foo \u2211 bar" //@hover("\\u2211", "'∑', U+2211, N-ARY SUMMATION") - - _ = '\a' //@hover("'\\a'", "U+0007, control") - _ = "foo \a bar" //@hover("\\a", "U+0007, control") - - _ = '\U0001F30A' //@hover("'\\U0001F30A'", "'🌊', U+1F30A, WATER WAVE") - _ = 0x0001F30A //@hover("0x0001F30A", "'🌊', U+1F30A, WATER WAVE") - _ = "foo \U0001F30A bar" //@hover("\\U0001F30A", "'🌊', U+1F30A, WATER WAVE") - - _ = '\x7E' //@hover("'\\x7E'", "'~', U+007E, TILDE") - _ = "foo \x7E bar" //@hover("\\x7E", "'~', U+007E, TILDE") - _ = "foo \a bar" //@hover("\\a", "U+0007, control") - - _ = '\173' //@hover("'\\173'", "'{', U+007B, LEFT CURLY BRACKET") - _ = "foo \173 bar" //@hover("\\173", "'{', U+007B, LEFT CURLY BRACKET") - _ = "foo \173 bar \u2211 baz" //@hover("\\173", "'{', U+007B, LEFT CURLY BRACKET") - _ = "foo \173 bar \u2211 baz" //@hover("\\u2211", "'∑', U+2211, N-ARY SUMMATION") - _ = "foo\173bar\u2211baz" //@hover("\\173", "'{', U+007B, LEFT CURLY BRACKET") - _ = "foo\173bar\u2211baz" //@hover("\\u2211", "'∑', U+2211, N-ARY SUMMATION") - - // search for runes in string only if there is an escaped sequence - _ = "hello" //@hover("\"hello\"", "") - - // incorrect escaped rune sequences - _ = '\0' //@hover("'\\0'", "") - _ = '\u22111' //@hover("'\\u22111'", "") - _ = '\U00110000' //@hover("'\\U00110000'", "") - _ = '\u12e45'//@hover("'\\u12e45'", "") - _ = '\xa' //@hover("'\\xa'", "") - _ = 'aa' //@hover("'aa'", "") - - // other basic lits - _ = 1 //@hover("1", "") - _ = 1.2 //@hover("1.2", "") - _ = 1.2i //@hover("1.2i", "") - _ = 0123 //@hover("0123", "") - _ = 0x1234567890 //@hover("0x1234567890", "") -} diff --git a/internal/lsp/testdata/baz/baz.go.in b/internal/lsp/testdata/baz/baz.go.in deleted file mode 100644 index 3b74ee580..000000000 --- a/internal/lsp/testdata/baz/baz.go.in +++ /dev/null @@ -1,33 +0,0 @@ -// +build go1.11 - -package baz - -import ( - "golang.org/x/tools/internal/lsp/bar" - - f "golang.org/x/tools/internal/lsp/foo" -) - -var FooStruct f.StructFoo - -func Baz() { - defer bar.Bar() //@complete("B", Bar) - // TODO(rstambler): Test completion here. - defer bar.B - var x f.IntFoo //@complete("n", IntFoo),typdef("x", IntFoo) - bar.Bar() //@complete("B", Bar) -} - -func _() { - bob := f.StructFoo{Value: 5} - if x := bob. //@complete(" //", Value) - switch true == false { - case true: - if x := bob. //@complete(" //", Value) - case false: - } - if x := bob.Va //@complete("a", Value) - switch true == true { - default: - } -} diff --git a/internal/lsp/testdata/builtins/builtin_args.go b/internal/lsp/testdata/builtins/builtin_args.go deleted file mode 100644 index 052777fe9..000000000 --- a/internal/lsp/testdata/builtins/builtin_args.go +++ /dev/null @@ -1,62 +0,0 @@ -package builtins - -func _() { - var ( - aSlice []int //@item(builtinSlice, "aSlice", "[]int", "var") - aMap map[string]int //@item(builtinMap, "aMap", "map[string]int", "var") - aString string //@item(builtinString, "aString", "string", "var") - aArray [0]int //@item(builtinArray, "aArray", "[0]int", "var") - aArrayPtr *[0]int //@item(builtinArrayPtr, "aArrayPtr", "*[0]int", "var") - aChan chan int //@item(builtinChan, "aChan", "chan int", "var") - aPtr *int //@item(builtinPtr, "aPtr", "*int", "var") - aInt int //@item(builtinInt, "aInt", "int", "var") - ) - - type ( - aSliceType []int //@item(builtinSliceType, "aSliceType", "[]int", "type") - aChanType chan int //@item(builtinChanType, "aChanType", "chan int", "type") - aMapType map[string]int //@item(builtinMapType, "aMapType", "map[string]int", "type") - ) - - close() //@rank(")", builtinChan, builtinSlice) - - append() //@rank(")", builtinSlice, builtinChan) - - var _ []byte = append([]byte(nil), ""...) //@rank(") //") - - copy() //@rank(")", builtinSlice, builtinChan) - copy(aSlice, aS) //@rank(")", builtinSlice, builtinString) - copy(aS, aSlice) //@rank(",", builtinSlice, builtinString) - - delete() //@rank(")", builtinMap, builtinChan) - delete(aMap, aS) //@rank(")", builtinString, builtinSlice) - - aMapFunc := func() map[int]int { //@item(builtinMapFunc, "aMapFunc", "func() map[int]int", "var") - return nil - } - delete() //@rank(")", builtinMapFunc, builtinSlice) - - len() //@rank(")", builtinSlice, builtinInt),rank(")", builtinMap, builtinInt),rank(")", builtinString, builtinInt),rank(")", builtinArray, builtinInt),rank(")", builtinArrayPtr, builtinPtr),rank(")", builtinChan, builtinInt) - - cap() //@rank(")", builtinSlice, builtinMap),rank(")", builtinArray, builtinString),rank(")", builtinArrayPtr, builtinPtr),rank(")", builtinChan, builtinInt) - - make() //@rank(")", builtinMapType, int),rank(")", builtinChanType, int),rank(")", builtinSliceType, int),rank(")", builtinMapType, int) - make(aSliceType, a) //@rank(")", builtinInt, builtinSlice) - - type myInt int - var mi myInt //@item(builtinMyInt, "mi", "myInt", "var") - make(aSliceType, m) //@snippet(")", builtinMyInt, "mi", "mi") - - var _ []int = make() //@rank(")", builtinSliceType, builtinMapType) - - type myStruct struct{} //@item(builtinStructType, "myStruct", "struct{...}", "struct") - var _ *myStruct = new() //@rank(")", builtinStructType, int) - - for k := range a { //@rank(" {", builtinSlice, builtinInt),rank(" {", builtinString, builtinInt),rank(" {", builtinChan, builtinInt),rank(" {", builtinArray, builtinInt),rank(" {", builtinArrayPtr, builtinInt),rank(" {", builtinMap, builtinInt), - } - - for k, v := range a { //@rank(" {", builtinSlice, builtinChan) - } - - <-a //@rank(" //", builtinChan, builtinInt) -} diff --git a/internal/lsp/testdata/builtins/builtin_types.go b/internal/lsp/testdata/builtins/builtin_types.go deleted file mode 100644 index 93a4a7095..000000000 --- a/internal/lsp/testdata/builtins/builtin_types.go +++ /dev/null @@ -1,11 +0,0 @@ -package builtins - -func _() { - var _ []bool //@item(builtinBoolSliceType, "[]bool", "[]bool", "type") - - var _ []bool = make() //@rank(")", builtinBoolSliceType, int) - - var _ []bool = make([], 0) //@rank(",", bool, int) - - var _ [][]bool = make([][], 0) //@rank(",", bool, int) -} diff --git a/internal/lsp/testdata/builtins/builtins.go b/internal/lsp/testdata/builtins/builtins.go deleted file mode 100644 index 25c29f21e..000000000 --- a/internal/lsp/testdata/builtins/builtins.go +++ /dev/null @@ -1,46 +0,0 @@ -package builtins - -func _() { - //@complete("", append, bool, byte, cap, close, complex, complex128, complex64, copy, delete, error, _false, float32, float64, imag, int, int16, int32, int64, int8, len, make, new, panic, print, println, real, recover, rune, string, _true, uint, uint16, uint32, uint64, uint8, uintptr, _nil) -} - -/* Create markers for builtin types. Only for use by this test. -/* append(slice []Type, elems ...Type) []Type */ //@item(append, "append", "func(slice []Type, elems ...Type) []Type", "func") -/* bool */ //@item(bool, "bool", "", "type") -/* byte */ //@item(byte, "byte", "", "type") -/* cap(v Type) int */ //@item(cap, "cap", "func(v Type) int", "func") -/* close(c chan<- Type) */ //@item(close, "close", "func(c chan<- Type)", "func") -/* complex(r float64, i float64) */ //@item(complex, "complex", "func(r float64, i float64) complex128", "func") -/* complex128 */ //@item(complex128, "complex128", "", "type") -/* complex64 */ //@item(complex64, "complex64", "", "type") -/* copy(dst []Type, src []Type) int */ //@item(copy, "copy", "func(dst []Type, src []Type) int", "func") -/* delete(m map[Type]Type1, key Type) */ //@item(delete, "delete", "func(m map[Type]Type1, key Type)", "func") -/* error */ //@item(error, "error", "", "interface") -/* false */ //@item(_false, "false", "", "const") -/* float32 */ //@item(float32, "float32", "", "type") -/* float64 */ //@item(float64, "float64", "", "type") -/* imag(c complex128) float64 */ //@item(imag, "imag", "func(c complex128) float64", "func") -/* int */ //@item(int, "int", "", "type") -/* int16 */ //@item(int16, "int16", "", "type") -/* int32 */ //@item(int32, "int32", "", "type") -/* int64 */ //@item(int64, "int64", "", "type") -/* int8 */ //@item(int8, "int8", "", "type") -/* iota */ //@item(iota, "iota", "", "const") -/* len(v Type) int */ //@item(len, "len", "func(v Type) int", "func") -/* make(t Type, size ...int) Type */ //@item(make, "make", "func(t Type, size ...int) Type", "func") -/* new(Type) *Type */ //@item(new, "new", "func(Type) *Type", "func") -/* nil */ //@item(_nil, "nil", "", "var") -/* panic(v interface{}) */ //@item(panic, "panic", "func(v interface{})", "func") -/* print(args ...Type) */ //@item(print, "print", "func(args ...Type)", "func") -/* println(args ...Type) */ //@item(println, "println", "func(args ...Type)", "func") -/* real(c complex128) float64 */ //@item(real, "real", "func(c complex128) float64", "func") -/* recover() interface{} */ //@item(recover, "recover", "func() interface{}", "func") -/* rune */ //@item(rune, "rune", "", "type") -/* string */ //@item(string, "string", "", "type") -/* true */ //@item(_true, "true", "", "const") -/* uint */ //@item(uint, "uint", "", "type") -/* uint16 */ //@item(uint16, "uint16", "", "type") -/* uint32 */ //@item(uint32, "uint32", "", "type") -/* uint64 */ //@item(uint64, "uint64", "", "type") -/* uint8 */ //@item(uint8, "uint8", "", "type") -/* uintptr */ //@item(uintptr, "uintptr", "", "type") diff --git a/internal/lsp/testdata/builtins/constants.go b/internal/lsp/testdata/builtins/constants.go deleted file mode 100644 index 7ad07bd1f..000000000 --- a/internal/lsp/testdata/builtins/constants.go +++ /dev/null @@ -1,19 +0,0 @@ -package builtins - -func _() { - const ( - foo = iota //@complete(" //", iota) - ) - - iota //@complete(" //") - - var iota int //@item(iotaVar, "iota", "int", "var") - - iota //@complete(" //", iotaVar) -} - -func _() { - var twoRedUpEnd bool //@item(TRUEVar, "twoRedUpEnd", "bool", "var") - - var _ bool = true //@rank(" //", _true, TRUEVar) -} diff --git a/internal/lsp/testdata/callhierarchy/callhierarchy.go b/internal/lsp/testdata/callhierarchy/callhierarchy.go deleted file mode 100644 index 58c23bdd6..000000000 --- a/internal/lsp/testdata/callhierarchy/callhierarchy.go +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2020 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package callhierarchy - -import "golang.org/x/tools/internal/lsp/callhierarchy/outgoing" - -func a() { //@mark(hierarchyA, "a") - D() -} - -func b() { //@mark(hierarchyB, "b") - D() -} - -// C is an exported function -func C() { //@mark(hierarchyC, "C") - D() - D() -} - -// To test hierarchy across function literals -var x = func() { //@mark(hierarchyLiteral, "func"),mark(hierarchyLiteralOut, "x") - D() -} - -// D is exported to test incoming/outgoing calls across packages -func D() { //@mark(hierarchyD, "D"),incomingcalls(hierarchyD, hierarchyA, hierarchyB, hierarchyC, hierarchyLiteral, incomingA),outgoingcalls(hierarchyD, hierarchyE, hierarchyF, hierarchyG, hierarchyLiteralOut, outgoingB, hierarchyFoo, hierarchyH, hierarchyI, hierarchyJ, hierarchyK) - e() - x() - F() - outgoing.B() - foo := func() {} //@mark(hierarchyFoo, "foo"),incomingcalls(hierarchyFoo, hierarchyD),outgoingcalls(hierarchyFoo) - foo() - - func() { - g() - }() - - var i Interface = impl{} - i.H() - i.I() - - s := Struct{} - s.J() - s.K() -} - -func e() {} //@mark(hierarchyE, "e") - -// F is an exported function -func F() {} //@mark(hierarchyF, "F") - -func g() {} //@mark(hierarchyG, "g") - -type Interface interface { - H() //@mark(hierarchyH, "H") - I() //@mark(hierarchyI, "I") -} - -type impl struct{} - -func (i impl) H() {} -func (i impl) I() {} - -type Struct struct { - J func() //@mark(hierarchyJ, "J") - K func() //@mark(hierarchyK, "K") -} diff --git a/internal/lsp/testdata/callhierarchy/incoming/incoming.go b/internal/lsp/testdata/callhierarchy/incoming/incoming.go deleted file mode 100644 index 3bfb4ad99..000000000 --- a/internal/lsp/testdata/callhierarchy/incoming/incoming.go +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2020 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package incoming - -import "golang.org/x/tools/internal/lsp/callhierarchy" - -// A is exported to test incoming calls across packages -func A() { //@mark(incomingA, "A") - callhierarchy.D() -} diff --git a/internal/lsp/testdata/callhierarchy/outgoing/outgoing.go b/internal/lsp/testdata/callhierarchy/outgoing/outgoing.go deleted file mode 100644 index 74362d419..000000000 --- a/internal/lsp/testdata/callhierarchy/outgoing/outgoing.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2020 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package outgoing - -// B is exported to test outgoing calls across packages -func B() { //@mark(outgoingB, "B") -} diff --git a/internal/lsp/testdata/casesensitive/casesensitive.go b/internal/lsp/testdata/casesensitive/casesensitive.go deleted file mode 100644 index 6f49d36ff..000000000 --- a/internal/lsp/testdata/casesensitive/casesensitive.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package casesensitive - -func _() { - var lower int //@item(lower, "lower", "int", "var") - var Upper int //@item(upper, "Upper", "int", "var") - - l //@casesensitive(" //", lower) - U //@casesensitive(" //", upper) - - L //@casesensitive(" //") - u //@casesensitive(" //") -} diff --git a/internal/lsp/testdata/cast/cast.go.in b/internal/lsp/testdata/cast/cast.go.in deleted file mode 100644 index 7fe21903c..000000000 --- a/internal/lsp/testdata/cast/cast.go.in +++ /dev/null @@ -1,11 +0,0 @@ -package cast - -func _() { - foo := struct{x int}{x: 1} //@item(x_field, "x", "int", "field") - _ = float64(foo.x) //@complete("x", x_field) -} - -func _() { - foo := struct{x int}{x: 1} - _ = float64(foo. //@complete(" /", x_field) -}
\ No newline at end of file diff --git a/internal/lsp/testdata/cgo/declarecgo.go b/internal/lsp/testdata/cgo/declarecgo.go deleted file mode 100644 index c283cdfb2..000000000 --- a/internal/lsp/testdata/cgo/declarecgo.go +++ /dev/null @@ -1,27 +0,0 @@ -package cgo - -/* -#include <stdio.h> -#include <stdlib.h> - -void myprint(char* s) { - printf("%s\n", s); -} -*/ -import "C" - -import ( - "fmt" - "unsafe" -) - -func Example() { //@mark(funccgoexample, "Example"),item(funccgoexample, "Example", "func()", "func") - fmt.Println() - cs := C.CString("Hello from stdio\n") - C.myprint(cs) - C.free(unsafe.Pointer(cs)) -} - -func _() { - Example() //@godef("ample", funccgoexample),complete("ample", funccgoexample) -} diff --git a/internal/lsp/testdata/cgo/declarecgo.go.golden b/internal/lsp/testdata/cgo/declarecgo.go.golden deleted file mode 100644 index b6d94d0c6..000000000 --- a/internal/lsp/testdata/cgo/declarecgo.go.golden +++ /dev/null @@ -1,30 +0,0 @@ --- funccgoexample-definition -- -cgo/declarecgo.go:18:6-13: defined here as ```go -func Example() -``` - -[`cgo.Example` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/cgo?utm_source=gopls#Example) --- funccgoexample-definition-json -- -{ - "span": { - "uri": "file://cgo/declarecgo.go", - "start": { - "line": 18, - "column": 6, - "offset": 151 - }, - "end": { - "line": 18, - "column": 13, - "offset": 158 - } - }, - "description": "```go\nfunc Example()\n```\n\n[`cgo.Example` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/cgo?utm_source=gopls#Example)" -} - --- funccgoexample-hoverdef -- -```go -func Example() -``` - -[`cgo.Example` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/cgo?utm_source=gopls#Example) diff --git a/internal/lsp/testdata/cgo/declarecgo_nocgo.go b/internal/lsp/testdata/cgo/declarecgo_nocgo.go deleted file mode 100644 index a05c01257..000000000 --- a/internal/lsp/testdata/cgo/declarecgo_nocgo.go +++ /dev/null @@ -1,6 +0,0 @@ -//+build !cgo - -package cgo - -// Set a dummy marker to keep the test framework happy. The tests should be skipped. -var _ = "Example" //@mark(funccgoexample, "Example"),godef("ample", funccgoexample),complete("ample", funccgoexample) diff --git a/internal/lsp/testdata/cgoimport/usecgo.go.golden b/internal/lsp/testdata/cgoimport/usecgo.go.golden deleted file mode 100644 index f33f94f84..000000000 --- a/internal/lsp/testdata/cgoimport/usecgo.go.golden +++ /dev/null @@ -1,30 +0,0 @@ --- funccgoexample-definition -- -cgo/declarecgo.go:18:6-13: defined here as ```go -func cgo.Example() -``` - -[`cgo.Example` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/cgo?utm_source=gopls#Example) --- funccgoexample-definition-json -- -{ - "span": { - "uri": "file://cgo/declarecgo.go", - "start": { - "line": 18, - "column": 6, - "offset": 151 - }, - "end": { - "line": 18, - "column": 13, - "offset": 158 - } - }, - "description": "```go\nfunc cgo.Example()\n```\n\n[`cgo.Example` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/cgo?utm_source=gopls#Example)" -} - --- funccgoexample-hoverdef -- -```go -func cgo.Example() -``` - -[`cgo.Example` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/cgo?utm_source=gopls#Example) diff --git a/internal/lsp/testdata/cgoimport/usecgo.go.in b/internal/lsp/testdata/cgoimport/usecgo.go.in deleted file mode 100644 index f258682ea..000000000 --- a/internal/lsp/testdata/cgoimport/usecgo.go.in +++ /dev/null @@ -1,9 +0,0 @@ -package cgoimport - -import ( - "golang.org/x/tools/internal/lsp/cgo" -) - -func _() { - cgo.Example() //@godef("ample", funccgoexample),complete("ample", funccgoexample) -} diff --git a/internal/lsp/testdata/channel/channel.go b/internal/lsp/testdata/channel/channel.go deleted file mode 100644 index d6bd311e3..000000000 --- a/internal/lsp/testdata/channel/channel.go +++ /dev/null @@ -1,25 +0,0 @@ -package channel - -func _() { - var ( - aa = "123" //@item(channelAA, "aa", "string", "var") - ab = 123 //@item(channelAB, "ab", "int", "var") - ) - - { - type myChan chan int - var mc myChan - mc <- a //@complete(" //", channelAB, channelAA) - } - - { - var ac chan int //@item(channelAC, "ac", "chan int", "var") - a <- a //@complete(" <-", channelAC, channelAA, channelAB) - } - - { - var foo chan int //@item(channelFoo, "foo", "chan int", "var") - wantsInt := func(int) {} //@item(channelWantsInt, "wantsInt", "func(int)", "var") - wantsInt(<-) //@rank(")", channelFoo, channelAB) - } -} diff --git a/internal/lsp/testdata/codelens/codelens_test.go b/internal/lsp/testdata/codelens/codelens_test.go deleted file mode 100644 index f6c696416..000000000 --- a/internal/lsp/testdata/codelens/codelens_test.go +++ /dev/null @@ -1,16 +0,0 @@ -package codelens //@codelens("package codelens", "run file benchmarks", "test") - -import "testing" - -func TestMain(m *testing.M) {} // no code lens for TestMain - -func TestFuncWithCodeLens(t *testing.T) { //@codelens("func", "run test", "test") -} - -func thisShouldNotHaveACodeLens(t *testing.T) { -} - -func BenchmarkFuncWithCodeLens(b *testing.B) { //@codelens("func", "run benchmark", "test") -} - -func helper() {} // expect no code lens diff --git a/internal/lsp/testdata/comment_completion/comment_completion.go.in b/internal/lsp/testdata/comment_completion/comment_completion.go.in deleted file mode 100644 index dbca0ff17..000000000 --- a/internal/lsp/testdata/comment_completion/comment_completion.go.in +++ /dev/null @@ -1,70 +0,0 @@ -package comment_completion - -var p bool - -//@complete(re"$") - -func _() { - var a int - - switch a { - case 1: - //@complete(re"$") - _ = a - } - - var b chan int - select { - case <-b: - //@complete(re"$") - _ = b - } - - var ( - //@complete(re"$") - _ = a - ) -} - -// //@complete(" ", variableC) -var C string //@item(variableC, "C", "string", "var") //@complete(" ", variableC) - -// //@complete(" ", constant) -const Constant = "example" //@item(constant, "Constant", "string", "const") //@complete(" ", constant) - -// //@complete(" ", structType, fieldB, fieldA) -type StructType struct { //@item(structType, "StructType", "struct{...}", "struct") //@complete(" ", structType, fieldA, fieldB) - // //@complete(" ", fieldA, structType, fieldB) - A string //@item(fieldA, "A", "string", "field") //@complete(" ", fieldA, structType, fieldB) - b int //@item(fieldB, "b", "int", "field") //@complete(" ", fieldB, structType, fieldA) -} - -// //@complete(" ", method, structRecv, paramX, resultY, fieldB, fieldA) -func (structType *StructType) Method(X int) (Y int) { //@item(structRecv, "structType", "*StructType", "var"),item(method, "Method", "func(X int) (Y int)", "method"),item(paramX, "X", "int", "var"),item(resultY, "Y", "int", "var") - // //@complete(" ", method, structRecv, paramX, resultY, fieldB, fieldA) - return -} - -// //@complete(" ", newType) -type NewType string //@item(newType, "NewType", "string", "type") //@complete(" ", newType) - -// //@complete(" ", testInterface, testA, testB) -type TestInterface interface { //@item(testInterface, "TestInterface", "interface{...}", "interface") - // //@complete(" ", testA, testInterface, testB) - TestA(L string) (M int) //@item(testA, "TestA", "func(L string) (M int)", "method"),item(paramL, "L", "var", "string"),item(resM, "M", "var", "int") //@complete(" ", testA, testInterface, testB) - TestB(N int) bool //@item(testB, "TestB", "func(N int) bool", "method"),item(paramN, "N", "var", "int") //@complete(" ", testB, testInterface, testA) -} - -// //@complete(" ", function) -func Function() int { //@item(function, "Function", "func() int", "func") //@complete(" ", function) - // //@complete(" ", function) - return 0 -} - -// This tests multiline block comments and completion with prefix -// Lorem Ipsum Multili//@complete("Multi", multiline) -// Lorem ipsum dolor sit ametom -func Multiline() int { //@item(multiline, "Multiline", "func() int", "func") - // //@complete(" ", multiline) - return 0 -} diff --git a/internal/lsp/testdata/complit/complit.go.in b/internal/lsp/testdata/complit/complit.go.in deleted file mode 100644 index e819810d8..000000000 --- a/internal/lsp/testdata/complit/complit.go.in +++ /dev/null @@ -1,90 +0,0 @@ -package complit - -// general completions - -type position struct { //@item(structPosition, "position", "struct{...}", "struct") - X, Y int //@item(fieldX, "X", "int", "field"),item(fieldY, "Y", "int", "field") -} - -func _() { - _ = position{ - //@complete("", fieldX, fieldY, structPosition) - } - _ = position{ - X: 1, - //@complete("", fieldY) - } - _ = position{ - //@complete("", fieldX) - Y: 1, - } - _ = []*position{ - { - //@complete("", fieldX, fieldY, structPosition) - }, - } -} - -func _() { - var ( - aa string //@item(aaVar, "aa", "string", "var") - ab int //@item(abVar, "ab", "int", "var") - ) - - _ = map[int]int{ - a: a, //@complete(":", abVar, aaVar),complete(",", abVar, aaVar) - } - - _ = map[int]int{ - //@complete("", abVar, aaVar, structPosition) - } - - _ = []string{a: ""} //@complete(":", abVar, aaVar) - _ = [1]string{a: ""} //@complete(":", abVar, aaVar) - - _ = position{X: a} //@complete("}", abVar, aaVar) - _ = position{a} //@complete("}", abVar, aaVar) - _ = position{a, } //@complete("}", abVar, aaVar, structPosition) - - _ = []int{a} //@complete("}", abVar, aaVar) - _ = [1]int{a} //@complete("}", abVar, aaVar) - - type myStruct struct { - AA int //@item(fieldAA, "AA", "int", "field") - AB string //@item(fieldAB, "AB", "string", "field") - } - - _ = myStruct{ - AB: a, //@complete(",", aaVar, abVar) - } - - var s myStruct - - _ = map[int]string{1: "" + s.A} //@complete("}", fieldAB, fieldAA) - _ = map[int]string{1: (func(i int) string { return "" })(s.A)} //@complete(")}", fieldAA, fieldAB) - _ = map[int]string{1: func() string { s.A }} //@complete(" }", fieldAA, fieldAB) - - _ = position{s.A} //@complete("}", fieldAA, fieldAB) - - var X int //@item(varX, "X", "int", "var") - _ = position{X} //@complete("}", fieldX, varX) -} - -func _() { - type foo struct{} //@item(complitFoo, "foo", "struct{...}", "struct") - - var _ *foo = &fo{} //@snippet("{", complitFoo, "foo", "foo") - var _ *foo = fo{} //@snippet("{", complitFoo, "&foo", "&foo") - - struct { a, b *foo }{ - a: &fo{}, //@rank("{", complitFoo) - b: fo{}, //@snippet("{", complitFoo, "&foo", "&foo") - } -} - -func _() { - _ := position{ - X: 1, //@complete("X", fieldX),complete(" 1", structPosition) - Y: , //@complete(":", fieldY),complete(" ,", structPosition) - } -} diff --git a/internal/lsp/testdata/constant/constant.go b/internal/lsp/testdata/constant/constant.go deleted file mode 100644 index c1c88e16e..000000000 --- a/internal/lsp/testdata/constant/constant.go +++ /dev/null @@ -1,14 +0,0 @@ -package constant - -const x = 1 //@item(constX, "x", "int", "const") - -const ( - a int = iota << 2 //@item(constA, "a", "int", "const") - b //@item(constB, "b", "int", "const") - c //@item(constC, "c", "int", "const") -) - -func _() { - const y = "hi" //@item(constY, "y", "string", "const") - //@complete("", constY, constA, constB, constC, constX) -} diff --git a/internal/lsp/testdata/danglingstmt/dangling_for.go b/internal/lsp/testdata/danglingstmt/dangling_for.go deleted file mode 100644 index a16d3bd88..000000000 --- a/internal/lsp/testdata/danglingstmt/dangling_for.go +++ /dev/null @@ -1,9 +0,0 @@ -package danglingstmt - -func _() { - for bar //@rank(" //", danglingBar) -} - -func bar() bool { //@item(danglingBar, "bar", "func() bool", "func") - return true -} diff --git a/internal/lsp/testdata/danglingstmt/dangling_for_init.go b/internal/lsp/testdata/danglingstmt/dangling_for_init.go deleted file mode 100644 index e1130bc23..000000000 --- a/internal/lsp/testdata/danglingstmt/dangling_for_init.go +++ /dev/null @@ -1,9 +0,0 @@ -package danglingstmt - -func _() { - for i := bar //@rank(" //", danglingBar2) -} - -func bar2() int { //@item(danglingBar2, "bar2", "func() int", "func") - return 0 -} diff --git a/internal/lsp/testdata/danglingstmt/dangling_for_init_cond.go b/internal/lsp/testdata/danglingstmt/dangling_for_init_cond.go deleted file mode 100644 index fb0269f16..000000000 --- a/internal/lsp/testdata/danglingstmt/dangling_for_init_cond.go +++ /dev/null @@ -1,9 +0,0 @@ -package danglingstmt - -func _() { - for i := bar3(); i > bar //@rank(" //", danglingBar3) -} - -func bar3() int { //@item(danglingBar3, "bar3", "func() int", "func") - return 0 -} diff --git a/internal/lsp/testdata/danglingstmt/dangling_for_init_cond_post.go b/internal/lsp/testdata/danglingstmt/dangling_for_init_cond_post.go deleted file mode 100644 index 14f78d392..000000000 --- a/internal/lsp/testdata/danglingstmt/dangling_for_init_cond_post.go +++ /dev/null @@ -1,9 +0,0 @@ -package danglingstmt - -func _() { - for i := bar4(); i > bar4(); i += bar //@rank(" //", danglingBar4) -} - -func bar4() int { //@item(danglingBar4, "bar4", "func() int", "func") - return 0 -} diff --git a/internal/lsp/testdata/danglingstmt/dangling_if.go b/internal/lsp/testdata/danglingstmt/dangling_if.go deleted file mode 100644 index 91f145ada..000000000 --- a/internal/lsp/testdata/danglingstmt/dangling_if.go +++ /dev/null @@ -1,9 +0,0 @@ -package danglingstmt - -func _() { - if foo //@rank(" //", danglingFoo) -} - -func foo() bool { //@item(danglingFoo, "foo", "func() bool", "func") - return true -} diff --git a/internal/lsp/testdata/danglingstmt/dangling_if_eof.go b/internal/lsp/testdata/danglingstmt/dangling_if_eof.go deleted file mode 100644 index 3454c9fa6..000000000 --- a/internal/lsp/testdata/danglingstmt/dangling_if_eof.go +++ /dev/null @@ -1,8 +0,0 @@ -package danglingstmt - -func bar5() bool { //@item(danglingBar5, "bar5", "func() bool", "func") - return true -} - -func _() { - if b //@rank(" //", danglingBar5) diff --git a/internal/lsp/testdata/danglingstmt/dangling_if_init.go b/internal/lsp/testdata/danglingstmt/dangling_if_init.go deleted file mode 100644 index 887c31860..000000000 --- a/internal/lsp/testdata/danglingstmt/dangling_if_init.go +++ /dev/null @@ -1,9 +0,0 @@ -package danglingstmt - -func _() { - if i := foo //@rank(" //", danglingFoo2) -} - -func foo2() bool { //@item(danglingFoo2, "foo2", "func() bool", "func") - return true -} diff --git a/internal/lsp/testdata/danglingstmt/dangling_if_init_cond.go b/internal/lsp/testdata/danglingstmt/dangling_if_init_cond.go deleted file mode 100644 index 5371283e9..000000000 --- a/internal/lsp/testdata/danglingstmt/dangling_if_init_cond.go +++ /dev/null @@ -1,9 +0,0 @@ -package danglingstmt - -func _() { - if i := 123; foo //@rank(" //", danglingFoo3) -} - -func foo3() bool { //@item(danglingFoo3, "foo3", "func() bool", "func") - return true -} diff --git a/internal/lsp/testdata/danglingstmt/dangling_multiline_if.go b/internal/lsp/testdata/danglingstmt/dangling_multiline_if.go deleted file mode 100644 index 2213777e1..000000000 --- a/internal/lsp/testdata/danglingstmt/dangling_multiline_if.go +++ /dev/null @@ -1,10 +0,0 @@ -package danglingstmt - -func walrus() bool { //@item(danglingWalrus, "walrus", "func() bool", "func") - return true -} - -func _() { - if true && - walrus //@complete(" //", danglingWalrus) -} diff --git a/internal/lsp/testdata/danglingstmt/dangling_selector_1.go b/internal/lsp/testdata/danglingstmt/dangling_selector_1.go deleted file mode 100644 index 772152f7b..000000000 --- a/internal/lsp/testdata/danglingstmt/dangling_selector_1.go +++ /dev/null @@ -1,7 +0,0 @@ -package danglingstmt - -func _() { - x. //@rank(" //", danglingI) -} - -var x struct { i int } //@item(danglingI, "i", "int", "field") diff --git a/internal/lsp/testdata/danglingstmt/dangling_selector_2.go b/internal/lsp/testdata/danglingstmt/dangling_selector_2.go deleted file mode 100644 index a9e75e82a..000000000 --- a/internal/lsp/testdata/danglingstmt/dangling_selector_2.go +++ /dev/null @@ -1,8 +0,0 @@ -package danglingstmt - -import "golang.org/x/tools/internal/lsp/foo" - -func _() { - foo. //@rank(" //", Foo) - var _ = []string{foo.} //@rank("}", Foo) -} diff --git a/internal/lsp/testdata/danglingstmt/dangling_switch_init.go b/internal/lsp/testdata/danglingstmt/dangling_switch_init.go deleted file mode 100644 index 15da3ce10..000000000 --- a/internal/lsp/testdata/danglingstmt/dangling_switch_init.go +++ /dev/null @@ -1,9 +0,0 @@ -package danglingstmt - -func _() { - switch i := baz //@rank(" //", danglingBaz) -} - -func baz() int { //@item(danglingBaz, "baz", "func() int", "func") - return 0 -} diff --git a/internal/lsp/testdata/danglingstmt/dangling_switch_init_tag.go b/internal/lsp/testdata/danglingstmt/dangling_switch_init_tag.go deleted file mode 100644 index 20b825b2e..000000000 --- a/internal/lsp/testdata/danglingstmt/dangling_switch_init_tag.go +++ /dev/null @@ -1,9 +0,0 @@ -package danglingstmt - -func _() { - switch i := 0; baz //@rank(" //", danglingBaz2) -} - -func baz2() int { //@item(danglingBaz2, "baz2", "func() int", "func") - return 0 -} diff --git a/internal/lsp/testdata/deep/deep.go b/internal/lsp/testdata/deep/deep.go deleted file mode 100644 index 6ed5ff839..000000000 --- a/internal/lsp/testdata/deep/deep.go +++ /dev/null @@ -1,135 +0,0 @@ -package deep - -import "context" - -type deepA struct { - b deepB //@item(deepBField, "b", "deepB", "field") -} - -type deepB struct { -} - -func wantsDeepB(deepB) {} - -func _() { - var a deepA //@item(deepAVar, "a", "deepA", "var") - a.b //@item(deepABField, "a.b", "deepB", "field") - wantsDeepB(a) //@deep(")", deepABField, deepAVar) - - deepA{a} //@snippet("}", deepABField, "a.b", "a.b") -} - -func wantsContext(context.Context) {} - -func _() { - context.Background() //@item(ctxBackground, "context.Background", "func() context.Context", "func", "Background returns a non-nil, empty Context.") - context.TODO() //@item(ctxTODO, "context.TODO", "func() context.Context", "func", "TODO returns a non-nil, empty Context.") - - wantsContext(c) //@rank(")", ctxBackground),rank(")", ctxTODO) -} - -func _() { - // deepCircle is circular. - type deepCircle struct { - *deepCircle - } - var circle deepCircle //@item(deepCircle, "circle", "deepCircle", "var") - circle.deepCircle //@item(deepCircleField, "circle.deepCircle", "*deepCircle", "field") - var _ deepCircle = circ //@deep(" //", deepCircle, deepCircleField),snippet(" //", deepCircleField, "*circle.deepCircle", "*circle.deepCircle") -} - -func _() { - type deepEmbedC struct { - } - type deepEmbedB struct { - deepEmbedC - } - type deepEmbedA struct { - deepEmbedB - } - - wantsC := func(deepEmbedC) {} - - var a deepEmbedA //@item(deepEmbedA, "a", "deepEmbedA", "var") - a.deepEmbedB //@item(deepEmbedB, "a.deepEmbedB", "deepEmbedB", "field") - a.deepEmbedC //@item(deepEmbedC, "a.deepEmbedC", "deepEmbedC", "field") - wantsC(a) //@deep(")", deepEmbedC, deepEmbedA, deepEmbedB) -} - -func _() { - type nested struct { - a int - n *nested //@item(deepNestedField, "n", "*nested", "field") - } - - nested{ - a: 123, //@deep(" //", deepNestedField) - } -} - -func _() { - var a struct { - b struct { - c int - } - d int - } - - a.d //@item(deepAD, "a.d", "int", "field") - a.b.c //@item(deepABC, "a.b.c", "int", "field") - a.b //@item(deepAB, "a.b", "struct{...}", "field") - a //@item(deepA, "a", "struct{...}", "var") - - // "a.d" should be ranked above the deeper "a.b.c" - var i int - i = a //@deep(" //", deepAD, deepABC, deepA, deepAB) -} - -type foo struct { - b bar -} - -func (f foo) bar() bar { - return f.b -} - -func (f foo) barPtr() *bar { - return &f.b -} - -type bar struct{} - -func (b bar) valueReceiver() int { - return 0 -} - -func (b *bar) ptrReceiver() int { - return 0 -} - -func _() { - var ( - i int - f foo - ) - - f.bar().valueReceiver //@item(deepBarValue, "f.bar().valueReceiver", "func() int", "method") - f.barPtr().ptrReceiver //@item(deepBarPtrPtr, "f.barPtr().ptrReceiver", "func() int", "method") - f.barPtr().valueReceiver //@item(deepBarPtrValue, "f.barPtr().valueReceiver", "func() int", "method") - - i = fbar //@fuzzy(" //", deepBarValue, deepBarPtrPtr, deepBarPtrValue) -} - -func (b baz) Thing() struct{ val int } { - return b.thing -} - -type baz struct { - thing struct{ val int } -} - -func (b baz) _() { - b.Thing().val //@item(deepBazMethVal, "b.Thing().val", "int", "field") - b.thing.val //@item(deepBazFieldVal, "b.thing.val", "int", "field") - var _ int = bval //@rank(" //", deepBazFieldVal, deepBazMethVal) -} diff --git a/internal/lsp/testdata/errors/errors.go b/internal/lsp/testdata/errors/errors.go deleted file mode 100644 index 42105629e..000000000 --- a/internal/lsp/testdata/errors/errors.go +++ /dev/null @@ -1,10 +0,0 @@ -package errors - -import ( - "golang.org/x/tools/internal/lsp/types" -) - -func _() { - bob.Bob() //@complete(".") - types.b //@complete(" //", Bob_interface) -} diff --git a/internal/lsp/testdata/extract/extract_function/extract_args_returns.go b/internal/lsp/testdata/extract/extract_function/extract_args_returns.go deleted file mode 100644 index 63d24df00..000000000 --- a/internal/lsp/testdata/extract/extract_function/extract_args_returns.go +++ /dev/null @@ -1,11 +0,0 @@ -package extract - -func _() { - a := 1 - a = 5 //@mark(exSt0, "a") - a = a + 2 //@mark(exEn0, "2") - //@extractfunc(exSt0, exEn0) - b := a * 2 //@mark(exB, " b") - _ = 3 + 4 //@mark(exEnd, "4") - //@extractfunc(exB, exEnd) -} diff --git a/internal/lsp/testdata/extract/extract_function/extract_args_returns.go.golden b/internal/lsp/testdata/extract/extract_function/extract_args_returns.go.golden deleted file mode 100644 index b15345e23..000000000 --- a/internal/lsp/testdata/extract/extract_function/extract_args_returns.go.golden +++ /dev/null @@ -1,37 +0,0 @@ --- functionextraction_extract_args_returns_5_2 -- -package extract - -func _() { - a := 1 - //@mark(exSt0, "a") - a = newFunction(a) //@mark(exEn0, "2") - //@extractfunc(exSt0, exEn0) - b := a * 2 //@mark(exB, " b") - _ = 3 + 4 //@mark(exEnd, "4") - //@extractfunc(exB, exEnd) -} - -func newFunction(a int) int { - a = 5 - a = a + 2 - return a -} - --- functionextraction_extract_args_returns_8_1 -- -package extract - -func _() { - a := 1 - a = 5 //@mark(exSt0, "a") - a = a + 2 //@mark(exEn0, "2") - //@extractfunc(exSt0, exEn0) - //@mark(exB, " b") - newFunction(a) //@mark(exEnd, "4") - //@extractfunc(exB, exEnd) -} - -func newFunction(a int) { - b := a * 2 - _ = 3 + 4 -} - diff --git a/internal/lsp/testdata/extract/extract_function/extract_basic.go b/internal/lsp/testdata/extract/extract_function/extract_basic.go deleted file mode 100644 index 5e44de26f..000000000 --- a/internal/lsp/testdata/extract/extract_function/extract_basic.go +++ /dev/null @@ -1,8 +0,0 @@ -package extract - -func _() { //@mark(exSt25, "{") - a := 1 //@mark(exSt1, "a") - _ = 3 + 4 //@mark(exEn1, "4") - //@extractfunc(exSt1, exEn1) - //@extractfunc(exSt25, exEn25) -} //@mark(exEn25, "}") diff --git a/internal/lsp/testdata/extract/extract_function/extract_basic.go.golden b/internal/lsp/testdata/extract/extract_function/extract_basic.go.golden deleted file mode 100644 index 18adc4db4..000000000 --- a/internal/lsp/testdata/extract/extract_function/extract_basic.go.golden +++ /dev/null @@ -1,30 +0,0 @@ --- functionextraction_extract_basic_3_10 -- -package extract - -func _() { //@mark(exSt25, "{") - //@mark(exSt1, "a") - newFunction() //@mark(exEn1, "4") - //@extractfunc(exSt1, exEn1) - //@extractfunc(exSt25, exEn25) -} - -func newFunction() { - a := 1 - _ = 3 + 4 -} //@mark(exEn25, "}") - --- functionextraction_extract_basic_4_2 -- -package extract - -func _() { //@mark(exSt25, "{") - //@mark(exSt1, "a") - newFunction() //@mark(exEn1, "4") - //@extractfunc(exSt1, exEn1) - //@extractfunc(exSt25, exEn25) -} - -func newFunction() { - a := 1 - _ = 3 + 4 -} //@mark(exEn25, "}") - diff --git a/internal/lsp/testdata/extract/extract_function/extract_basic_comment.go b/internal/lsp/testdata/extract/extract_function/extract_basic_comment.go deleted file mode 100644 index 4e2b12fbc..000000000 --- a/internal/lsp/testdata/extract/extract_function/extract_basic_comment.go +++ /dev/null @@ -1,8 +0,0 @@ -package extract - -func _() { - a := /* comment in the middle of a line */ 1 //@mark(exSt18, "a") - // Comment on its own line - _ = 3 + 4 //@mark(exEn18, "4") - //@extractfunc(exSt18, exEn18) -} diff --git a/internal/lsp/testdata/extract/extract_function/extract_basic_comment.go.golden b/internal/lsp/testdata/extract/extract_function/extract_basic_comment.go.golden deleted file mode 100644 index a43822a90..000000000 --- a/internal/lsp/testdata/extract/extract_function/extract_basic_comment.go.golden +++ /dev/null @@ -1,17 +0,0 @@ --- functionextraction_extract_basic_comment_4_2 -- -package extract - -func _() { - /* comment in the middle of a line */ - //@mark(exSt18, "a") - // Comment on its own line - newFunction() //@mark(exEn18, "4") - //@extractfunc(exSt18, exEn18) -} - -func newFunction() { - a := 1 - - _ = 3 + 4 -} - diff --git a/internal/lsp/testdata/extract/extract_function/extract_issue_44813.go b/internal/lsp/testdata/extract/extract_function/extract_issue_44813.go deleted file mode 100644 index 9713b9101..000000000 --- a/internal/lsp/testdata/extract/extract_function/extract_issue_44813.go +++ /dev/null @@ -1,13 +0,0 @@ -package extract - -import "fmt" - -func main() { - x := []rune{} //@mark(exSt9, "x") - s := "HELLO" - for _, c := range s { - x = append(x, c) - } //@mark(exEn9, "}") - //@extractfunc(exSt9, exEn9) - fmt.Printf("%x\n", x) -} diff --git a/internal/lsp/testdata/extract/extract_function/extract_issue_44813.go.golden b/internal/lsp/testdata/extract/extract_function/extract_issue_44813.go.golden deleted file mode 100644 index 3198c9fa2..000000000 --- a/internal/lsp/testdata/extract/extract_function/extract_issue_44813.go.golden +++ /dev/null @@ -1,21 +0,0 @@ --- functionextraction_extract_issue_44813_6_2 -- -package extract - -import "fmt" - -func main() { - //@mark(exSt9, "x") - x := newFunction() //@mark(exEn9, "}") - //@extractfunc(exSt9, exEn9) - fmt.Printf("%x\n", x) -} - -func newFunction() []rune { - x := []rune{} - s := "HELLO" - for _, c := range s { - x = append(x, c) - } - return x -} - diff --git a/internal/lsp/testdata/extract/extract_function/extract_redefine.go b/internal/lsp/testdata/extract/extract_function/extract_redefine.go deleted file mode 100644 index 604f4757c..000000000 --- a/internal/lsp/testdata/extract/extract_function/extract_redefine.go +++ /dev/null @@ -1,11 +0,0 @@ -package extract - -import "strconv" - -func _() { - i, err := strconv.Atoi("1") - u, err := strconv.Atoi("2") //@extractfunc("u", ")") - if i == u || err == nil { - return - } -} diff --git a/internal/lsp/testdata/extract/extract_function/extract_redefine.go.golden b/internal/lsp/testdata/extract/extract_function/extract_redefine.go.golden deleted file mode 100644 index e2ee217d1..000000000 --- a/internal/lsp/testdata/extract/extract_function/extract_redefine.go.golden +++ /dev/null @@ -1,18 +0,0 @@ --- functionextraction_extract_redefine_7_2 -- -package extract - -import "strconv" - -func _() { - i, err := strconv.Atoi("1") - u, err := newFunction() //@extractfunc("u", ")") - if i == u || err == nil { - return - } -} - -func newFunction() (int, error) { - u, err := strconv.Atoi("2") - return u, err -} - diff --git a/internal/lsp/testdata/extract/extract_function/extract_return_basic.go b/internal/lsp/testdata/extract/extract_function/extract_return_basic.go deleted file mode 100644 index 1ff24daeb..000000000 --- a/internal/lsp/testdata/extract/extract_function/extract_return_basic.go +++ /dev/null @@ -1,10 +0,0 @@ -package extract - -func _() bool { - x := 1 - if x == 0 { //@mark(exSt2, "if") - return true - } //@mark(exEn2, "}") - return false - //@extractfunc(exSt2, exEn2) -} diff --git a/internal/lsp/testdata/extract/extract_function/extract_return_basic.go.golden b/internal/lsp/testdata/extract/extract_function/extract_return_basic.go.golden deleted file mode 100644 index 6103d1ee9..000000000 --- a/internal/lsp/testdata/extract/extract_function/extract_return_basic.go.golden +++ /dev/null @@ -1,21 +0,0 @@ --- functionextraction_extract_return_basic_5_2 -- -package extract - -func _() bool { - x := 1 - //@mark(exSt2, "if") - shouldReturn, returnValue := newFunction(x) - if shouldReturn { - return returnValue - } //@mark(exEn2, "}") - return false - //@extractfunc(exSt2, exEn2) -} - -func newFunction(x int) (bool, bool) { - if x == 0 { - return true, true - } - return false, false -} - diff --git a/internal/lsp/testdata/extract/extract_function/extract_return_basic_nonnested.go b/internal/lsp/testdata/extract/extract_function/extract_return_basic_nonnested.go deleted file mode 100644 index 08573acdd..000000000 --- a/internal/lsp/testdata/extract/extract_function/extract_return_basic_nonnested.go +++ /dev/null @@ -1,10 +0,0 @@ -package extract - -func _() bool { - x := 1 //@mark(exSt13, "x") - if x == 0 { - return true - } - return false //@mark(exEn13, "false") - //@extractfunc(exSt13, exEn13) -} diff --git a/internal/lsp/testdata/extract/extract_function/extract_return_basic_nonnested.go.golden b/internal/lsp/testdata/extract/extract_function/extract_return_basic_nonnested.go.golden deleted file mode 100644 index 19e48da01..000000000 --- a/internal/lsp/testdata/extract/extract_function/extract_return_basic_nonnested.go.golden +++ /dev/null @@ -1,17 +0,0 @@ --- functionextraction_extract_return_basic_nonnested_4_2 -- -package extract - -func _() bool { - //@mark(exSt13, "x") - return newFunction() //@mark(exEn13, "false") - //@extractfunc(exSt13, exEn13) -} - -func newFunction() bool { - x := 1 - if x == 0 { - return true - } - return false -} - diff --git a/internal/lsp/testdata/extract/extract_function/extract_return_complex.go b/internal/lsp/testdata/extract/extract_function/extract_return_complex.go deleted file mode 100644 index 605c5ec2e..000000000 --- a/internal/lsp/testdata/extract/extract_function/extract_return_complex.go +++ /dev/null @@ -1,17 +0,0 @@ -package extract - -import "fmt" - -func _() (int, string, error) { - x := 1 - y := "hello" - z := "bye" //@mark(exSt3, "z") - if y == z { - return x, y, fmt.Errorf("same") - } else { - z = "hi" - return x, z, nil - } //@mark(exEn3, "}") - return x, z, nil - //@extractfunc(exSt3, exEn3) -} diff --git a/internal/lsp/testdata/extract/extract_function/extract_return_complex.go.golden b/internal/lsp/testdata/extract/extract_function/extract_return_complex.go.golden deleted file mode 100644 index 4d201227a..000000000 --- a/internal/lsp/testdata/extract/extract_function/extract_return_complex.go.golden +++ /dev/null @@ -1,28 +0,0 @@ --- functionextraction_extract_return_complex_8_2 -- -package extract - -import "fmt" - -func _() (int, string, error) { - x := 1 - y := "hello" - //@mark(exSt3, "z") - z, shouldReturn, returnValue, returnValue1, returnValue2 := newFunction(y, x) - if shouldReturn { - return returnValue, returnValue1, returnValue2 - } //@mark(exEn3, "}") - return x, z, nil - //@extractfunc(exSt3, exEn3) -} - -func newFunction(y string, x int) (string, bool, int, string, error) { - z := "bye" - if y == z { - return "", true, x, y, fmt.Errorf("same") - } else { - z = "hi" - return "", true, x, z, nil - } - return z, false, 0, "", nil -} - diff --git a/internal/lsp/testdata/extract/extract_function/extract_return_complex_nonnested.go b/internal/lsp/testdata/extract/extract_function/extract_return_complex_nonnested.go deleted file mode 100644 index 6b2a4d8c0..000000000 --- a/internal/lsp/testdata/extract/extract_function/extract_return_complex_nonnested.go +++ /dev/null @@ -1,17 +0,0 @@ -package extract - -import "fmt" - -func _() (int, string, error) { - x := 1 - y := "hello" - z := "bye" //@mark(exSt10, "z") - if y == z { - return x, y, fmt.Errorf("same") - } else { - z = "hi" - return x, z, nil - } - return x, z, nil //@mark(exEn10, "nil") - //@extractfunc(exSt10, exEn10) -} diff --git a/internal/lsp/testdata/extract/extract_function/extract_return_complex_nonnested.go.golden b/internal/lsp/testdata/extract/extract_function/extract_return_complex_nonnested.go.golden deleted file mode 100644 index de54b1534..000000000 --- a/internal/lsp/testdata/extract/extract_function/extract_return_complex_nonnested.go.golden +++ /dev/null @@ -1,24 +0,0 @@ --- functionextraction_extract_return_complex_nonnested_8_2 -- -package extract - -import "fmt" - -func _() (int, string, error) { - x := 1 - y := "hello" - //@mark(exSt10, "z") - return newFunction(y, x) //@mark(exEn10, "nil") - //@extractfunc(exSt10, exEn10) -} - -func newFunction(y string, x int) (int, string, error) { - z := "bye" - if y == z { - return x, y, fmt.Errorf("same") - } else { - z = "hi" - return x, z, nil - } - return x, z, nil -} - diff --git a/internal/lsp/testdata/extract/extract_function/extract_return_func_lit.go b/internal/lsp/testdata/extract/extract_function/extract_return_func_lit.go deleted file mode 100644 index b3fb4fd21..000000000 --- a/internal/lsp/testdata/extract/extract_function/extract_return_func_lit.go +++ /dev/null @@ -1,13 +0,0 @@ -package extract - -import "go/ast" - -func _() { - ast.Inspect(ast.NewIdent("a"), func(n ast.Node) bool { - if n == nil { //@mark(exSt4, "if") - return true - } //@mark(exEn4, "}") - return false - }) - //@extractfunc(exSt4, exEn4) -} diff --git a/internal/lsp/testdata/extract/extract_function/extract_return_func_lit.go.golden b/internal/lsp/testdata/extract/extract_function/extract_return_func_lit.go.golden deleted file mode 100644 index 3af747c22..000000000 --- a/internal/lsp/testdata/extract/extract_function/extract_return_func_lit.go.golden +++ /dev/null @@ -1,24 +0,0 @@ --- functionextraction_extract_return_func_lit_7_3 -- -package extract - -import "go/ast" - -func _() { - ast.Inspect(ast.NewIdent("a"), func(n ast.Node) bool { - //@mark(exSt4, "if") - shouldReturn, returnValue := newFunction(n) - if shouldReturn { - return returnValue - } //@mark(exEn4, "}") - return false - }) - //@extractfunc(exSt4, exEn4) -} - -func newFunction(n ast.Node) (bool, bool) { - if n == nil { - return true, true - } - return false, false -} - diff --git a/internal/lsp/testdata/extract/extract_function/extract_return_func_lit_nonnested.go b/internal/lsp/testdata/extract/extract_function/extract_return_func_lit_nonnested.go deleted file mode 100644 index c22db2a6d..000000000 --- a/internal/lsp/testdata/extract/extract_function/extract_return_func_lit_nonnested.go +++ /dev/null @@ -1,13 +0,0 @@ -package extract - -import "go/ast" - -func _() { - ast.Inspect(ast.NewIdent("a"), func(n ast.Node) bool { - if n == nil { //@mark(exSt11, "if") - return true - } - return false //@mark(exEn11, "false") - }) - //@extractfunc(exSt11, exEn11) -} diff --git a/internal/lsp/testdata/extract/extract_function/extract_return_func_lit_nonnested.go.golden b/internal/lsp/testdata/extract/extract_function/extract_return_func_lit_nonnested.go.golden deleted file mode 100644 index efa22ba2b..000000000 --- a/internal/lsp/testdata/extract/extract_function/extract_return_func_lit_nonnested.go.golden +++ /dev/null @@ -1,20 +0,0 @@ --- functionextraction_extract_return_func_lit_nonnested_7_3 -- -package extract - -import "go/ast" - -func _() { - ast.Inspect(ast.NewIdent("a"), func(n ast.Node) bool { - //@mark(exSt11, "if") - return newFunction(n) //@mark(exEn11, "false") - }) - //@extractfunc(exSt11, exEn11) -} - -func newFunction(n ast.Node) bool { - if n == nil { - return true - } - return false -} - diff --git a/internal/lsp/testdata/extract/extract_function/extract_return_init.go b/internal/lsp/testdata/extract/extract_function/extract_return_init.go deleted file mode 100644 index c1994c1c1..000000000 --- a/internal/lsp/testdata/extract/extract_function/extract_return_init.go +++ /dev/null @@ -1,12 +0,0 @@ -package extract - -func _() string { - x := 1 - if x == 0 { //@mark(exSt5, "if") - x = 3 - return "a" - } //@mark(exEn5, "}") - x = 2 - return "b" - //@extractfunc(exSt5, exEn5) -} diff --git a/internal/lsp/testdata/extract/extract_function/extract_return_init.go.golden b/internal/lsp/testdata/extract/extract_function/extract_return_init.go.golden deleted file mode 100644 index 31d1b2ddf..000000000 --- a/internal/lsp/testdata/extract/extract_function/extract_return_init.go.golden +++ /dev/null @@ -1,23 +0,0 @@ --- functionextraction_extract_return_init_5_2 -- -package extract - -func _() string { - x := 1 - //@mark(exSt5, "if") - shouldReturn, returnValue := newFunction(x) - if shouldReturn { - return returnValue - } //@mark(exEn5, "}") - x = 2 - return "b" - //@extractfunc(exSt5, exEn5) -} - -func newFunction(x int) (bool, string) { - if x == 0 { - x = 3 - return true, "a" - } - return false, "" -} - diff --git a/internal/lsp/testdata/extract/extract_function/extract_return_init_nonnested.go b/internal/lsp/testdata/extract/extract_function/extract_return_init_nonnested.go deleted file mode 100644 index bb5ed083c..000000000 --- a/internal/lsp/testdata/extract/extract_function/extract_return_init_nonnested.go +++ /dev/null @@ -1,12 +0,0 @@ -package extract - -func _() string { - x := 1 - if x == 0 { //@mark(exSt12, "if") - x = 3 - return "a" - } - x = 2 - return "b" //@mark(exEn12, "\"b\"") - //@extractfunc(exSt12, exEn12) -} diff --git a/internal/lsp/testdata/extract/extract_function/extract_return_init_nonnested.go.golden b/internal/lsp/testdata/extract/extract_function/extract_return_init_nonnested.go.golden deleted file mode 100644 index 58bb57325..000000000 --- a/internal/lsp/testdata/extract/extract_function/extract_return_init_nonnested.go.golden +++ /dev/null @@ -1,19 +0,0 @@ --- functionextraction_extract_return_init_nonnested_5_2 -- -package extract - -func _() string { - x := 1 - //@mark(exSt12, "if") - return newFunction(x) //@mark(exEn12, "\"b\"") - //@extractfunc(exSt12, exEn12) -} - -func newFunction(x int) string { - if x == 0 { - x = 3 - return "a" - } - x = 2 - return "b" -} - diff --git a/internal/lsp/testdata/extract/extract_function/extract_scope.go b/internal/lsp/testdata/extract/extract_function/extract_scope.go deleted file mode 100644 index 6cc141fd1..000000000 --- a/internal/lsp/testdata/extract/extract_function/extract_scope.go +++ /dev/null @@ -1,10 +0,0 @@ -package extract - -func _() { - newFunction := 1 - a := newFunction //@extractfunc("a", "newFunction") -} - -func newFunction1() int { - return 1 -} diff --git a/internal/lsp/testdata/extract/extract_function/extract_scope.go.golden b/internal/lsp/testdata/extract/extract_function/extract_scope.go.golden deleted file mode 100644 index a4803b4fe..000000000 --- a/internal/lsp/testdata/extract/extract_function/extract_scope.go.golden +++ /dev/null @@ -1,16 +0,0 @@ --- functionextraction_extract_scope_5_2 -- -package extract - -func _() { - newFunction := 1 - newFunction2(newFunction) //@extractfunc("a", "newFunction") -} - -func newFunction2(newFunction int) { - a := newFunction -} - -func newFunction1() int { - return 1 -} - diff --git a/internal/lsp/testdata/extract/extract_function/extract_smart_initialization.go b/internal/lsp/testdata/extract/extract_function/extract_smart_initialization.go deleted file mode 100644 index da2c669a8..000000000 --- a/internal/lsp/testdata/extract/extract_function/extract_smart_initialization.go +++ /dev/null @@ -1,9 +0,0 @@ -package extract - -func _() { - var a []int - a = append(a, 2) //@mark(exSt6, "a") - b := 4 //@mark(exEn6, "4") - //@extractfunc(exSt6, exEn6) - a = append(a, b) -} diff --git a/internal/lsp/testdata/extract/extract_function/extract_smart_initialization.go.golden b/internal/lsp/testdata/extract/extract_function/extract_smart_initialization.go.golden deleted file mode 100644 index 8be5040c4..000000000 --- a/internal/lsp/testdata/extract/extract_function/extract_smart_initialization.go.golden +++ /dev/null @@ -1,17 +0,0 @@ --- functionextraction_extract_smart_initialization_5_2 -- -package extract - -func _() { - var a []int - //@mark(exSt6, "a") - a, b := newFunction(a) //@mark(exEn6, "4") - //@extractfunc(exSt6, exEn6) - a = append(a, b) -} - -func newFunction(a []int) ([]int, int) { - a = append(a, 2) - b := 4 - return a, b -} - diff --git a/internal/lsp/testdata/extract/extract_function/extract_smart_return.go b/internal/lsp/testdata/extract/extract_function/extract_smart_return.go deleted file mode 100644 index 264d680e2..000000000 --- a/internal/lsp/testdata/extract/extract_function/extract_smart_return.go +++ /dev/null @@ -1,11 +0,0 @@ -package extract - -func _() { - var b []int - var a int - a = 2 //@mark(exSt7, "a") - b = []int{} - b = append(b, a) //@mark(exEn7, ")") - b[0] = 1 - //@extractfunc(exSt7, exEn7) -} diff --git a/internal/lsp/testdata/extract/extract_function/extract_smart_return.go.golden b/internal/lsp/testdata/extract/extract_function/extract_smart_return.go.golden deleted file mode 100644 index fdf55ae6d..000000000 --- a/internal/lsp/testdata/extract/extract_function/extract_smart_return.go.golden +++ /dev/null @@ -1,19 +0,0 @@ --- functionextraction_extract_smart_return_6_2 -- -package extract - -func _() { - var b []int - var a int - //@mark(exSt7, "a") - b = newFunction(a, b) //@mark(exEn7, ")") - b[0] = 1 - //@extractfunc(exSt7, exEn7) -} - -func newFunction(a int, b []int) []int { - a = 2 - b = []int{} - b = append(b, a) - return b -} - diff --git a/internal/lsp/testdata/extract/extract_function/extract_unnecessary_param.go b/internal/lsp/testdata/extract/extract_function/extract_unnecessary_param.go deleted file mode 100644 index a6eb1f872..000000000 --- a/internal/lsp/testdata/extract/extract_function/extract_unnecessary_param.go +++ /dev/null @@ -1,14 +0,0 @@ -package extract - -func _() { - var b []int - var a int - a := 2 //@mark(exSt8, "a") - b = []int{} - b = append(b, a) //@mark(exEn8, ")") - b[0] = 1 - if a == 2 { - return - } - //@extractfunc(exSt8, exEn8) -} diff --git a/internal/lsp/testdata/extract/extract_function/extract_unnecessary_param.go.golden b/internal/lsp/testdata/extract/extract_function/extract_unnecessary_param.go.golden deleted file mode 100644 index 4374f3728..000000000 --- a/internal/lsp/testdata/extract/extract_function/extract_unnecessary_param.go.golden +++ /dev/null @@ -1,22 +0,0 @@ --- functionextraction_extract_unnecessary_param_6_2 -- -package extract - -func _() { - var b []int - var a int - //@mark(exSt8, "a") - a, b = newFunction(b) //@mark(exEn8, ")") - b[0] = 1 - if a == 2 { - return - } - //@extractfunc(exSt8, exEn8) -} - -func newFunction(b []int) (int, []int) { - a := 2 - b = []int{} - b = append(b, a) - return a, b -} - diff --git a/internal/lsp/testdata/extract/extract_method/extract_basic.go b/internal/lsp/testdata/extract/extract_method/extract_basic.go deleted file mode 100644 index c9a8d9dce..000000000 --- a/internal/lsp/testdata/extract/extract_method/extract_basic.go +++ /dev/null @@ -1,24 +0,0 @@ -package extract - -type A struct { - x int - y int -} - -func (a *A) XLessThanYP() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a *A) AddP() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - -func (a A) XLessThanY() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a A) Add() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} diff --git a/internal/lsp/testdata/extract/extract_method/extract_basic.go.golden b/internal/lsp/testdata/extract/extract_method/extract_basic.go.golden deleted file mode 100644 index eab22a673..000000000 --- a/internal/lsp/testdata/extract/extract_method/extract_basic.go.golden +++ /dev/null @@ -1,728 +0,0 @@ --- functionextraction_extract_basic_13_2 -- -package extract - -type A struct { - x int - y int -} - -func (a *A) XLessThanYP() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a *A) AddP() int { - sum := newFunction(a) //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - -func newFunction(a *A) int { - sum := a.x + a.y - return sum -} - -func (a A) XLessThanY() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a A) Add() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - --- functionextraction_extract_basic_14_2 -- -package extract - -type A struct { - x int - y int -} - -func (a *A) XLessThanYP() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a *A) AddP() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return newFunction(sum) //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - -func newFunction(sum int) int { - return sum -} - -func (a A) XLessThanY() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a A) Add() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - --- functionextraction_extract_basic_18_2 -- -package extract - -type A struct { - x int - y int -} - -func (a *A) XLessThanYP() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a *A) AddP() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - -func (a A) XLessThanY() bool { - return newFunction(a) //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func newFunction(a A) bool { - return a.x < a.y -} - -func (a A) Add() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - --- functionextraction_extract_basic_22_2 -- -package extract - -type A struct { - x int - y int -} - -func (a *A) XLessThanYP() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a *A) AddP() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - -func (a A) XLessThanY() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a A) Add() int { - sum := newFunction(a) //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - -func newFunction(a A) int { - sum := a.x + a.y - return sum -} - --- functionextraction_extract_basic_23_2 -- -package extract - -type A struct { - x int - y int -} - -func (a *A) XLessThanYP() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a *A) AddP() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - -func (a A) XLessThanY() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a A) Add() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return newFunction(sum) //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - -func newFunction(sum int) int { - return sum -} - --- functionextraction_extract_basic_9_2 -- -package extract - -type A struct { - x int - y int -} - -func (a *A) XLessThanYP() bool { - return newFunction(a) //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func newFunction(a *A) bool { - return a.x < a.y -} - -func (a *A) AddP() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - -func (a A) XLessThanY() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a A) Add() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - --- functionextraction_extract_method_13_2 -- -package extract - -type A struct { - x int - y int -} - -func (a *A) XLessThanYP() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a *A) AddP() int { - sum := newFunction(a) //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - -func newFunction(a *A) int { - sum := a.x + a.y - return sum -} - -func (a A) XLessThanY() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a A) Add() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - --- functionextraction_extract_method_14_2 -- -package extract - -type A struct { - x int - y int -} - -func (a *A) XLessThanYP() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a *A) AddP() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return newFunction(sum) //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - -func newFunction(sum int) int { - return sum -} - -func (a A) XLessThanY() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a A) Add() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - --- functionextraction_extract_method_18_2 -- -package extract - -type A struct { - x int - y int -} - -func (a *A) XLessThanYP() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a *A) AddP() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - -func (a A) XLessThanY() bool { - return newFunction(a) //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func newFunction(a A) bool { - return a.x < a.y -} - -func (a A) Add() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - --- functionextraction_extract_method_22_2 -- -package extract - -type A struct { - x int - y int -} - -func (a *A) XLessThanYP() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a *A) AddP() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - -func (a A) XLessThanY() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a A) Add() int { - sum := newFunction(a) //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - -func newFunction(a A) int { - sum := a.x + a.y - return sum -} - --- functionextraction_extract_method_23_2 -- -package extract - -type A struct { - x int - y int -} - -func (a *A) XLessThanYP() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a *A) AddP() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - -func (a A) XLessThanY() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a A) Add() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return newFunction(sum) //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - -func newFunction(sum int) int { - return sum -} - --- functionextraction_extract_method_9_2 -- -package extract - -type A struct { - x int - y int -} - -func (a *A) XLessThanYP() bool { - return newFunction(a) //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func newFunction(a *A) bool { - return a.x < a.y -} - -func (a *A) AddP() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - -func (a A) XLessThanY() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a A) Add() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - --- methodextraction_extract_basic_13_2 -- -package extract - -type A struct { - x int - y int -} - -func (a *A) XLessThanYP() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a *A) AddP() int { - sum := a.newMethod() //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - -func (a *A) newMethod() int { - sum := a.x + a.y - return sum -} - -func (a A) XLessThanY() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a A) Add() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - --- methodextraction_extract_basic_14_2 -- -package extract - -type A struct { - x int - y int -} - -func (a *A) XLessThanYP() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a *A) AddP() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return a.newMethod(sum) //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - -func (*A) newMethod(sum int) int { - return sum -} - -func (a A) XLessThanY() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a A) Add() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - --- methodextraction_extract_basic_18_2 -- -package extract - -type A struct { - x int - y int -} - -func (a *A) XLessThanYP() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a *A) AddP() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - -func (a A) XLessThanY() bool { - return a.newMethod() //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a A) newMethod() bool { - return a.x < a.y -} - -func (a A) Add() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - --- methodextraction_extract_basic_22_2 -- -package extract - -type A struct { - x int - y int -} - -func (a *A) XLessThanYP() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a *A) AddP() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - -func (a A) XLessThanY() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a A) Add() int { - sum := a.newMethod() //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - -func (a A) newMethod() int { - sum := a.x + a.y - return sum -} - --- methodextraction_extract_basic_23_2 -- -package extract - -type A struct { - x int - y int -} - -func (a *A) XLessThanYP() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a *A) AddP() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - -func (a A) XLessThanY() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a A) Add() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return a.newMethod(sum) //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - -func (A) newMethod(sum int) int { - return sum -} - --- methodextraction_extract_basic_9_2 -- -package extract - -type A struct { - x int - y int -} - -func (a *A) XLessThanYP() bool { - return a.newMethod() //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a *A) newMethod() bool { - return a.x < a.y -} - -func (a *A) AddP() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - -func (a A) XLessThanY() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a A) Add() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - --- methodextraction_extract_method_13_2 -- -package extract - -type A struct { - x int - y int -} - -func (a *A) XLessThanYP() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a *A) AddP() int { - sum := a.newMethod() //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - -func (a *A) newMethod() int { - sum := a.x + a.y - return sum -} - -func (a A) XLessThanY() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a A) Add() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - --- methodextraction_extract_method_14_2 -- -package extract - -type A struct { - x int - y int -} - -func (a *A) XLessThanYP() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a *A) AddP() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return a.newMethod(sum) //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - -func (*A) newMethod(sum int) int { - return sum -} - -func (a A) XLessThanY() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a A) Add() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - --- methodextraction_extract_method_18_2 -- -package extract - -type A struct { - x int - y int -} - -func (a *A) XLessThanYP() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a *A) AddP() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - -func (a A) XLessThanY() bool { - return a.newMethod() //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a A) newMethod() bool { - return a.x < a.y -} - -func (a A) Add() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - --- methodextraction_extract_method_22_2 -- -package extract - -type A struct { - x int - y int -} - -func (a *A) XLessThanYP() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a *A) AddP() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - -func (a A) XLessThanY() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a A) Add() int { - sum := a.newMethod() //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - -func (a A) newMethod() int { - sum := a.x + a.y - return sum -} - --- methodextraction_extract_method_23_2 -- -package extract - -type A struct { - x int - y int -} - -func (a *A) XLessThanYP() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a *A) AddP() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - -func (a A) XLessThanY() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a A) Add() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return a.newMethod(sum) //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - -func (A) newMethod(sum int) int { - return sum -} - --- methodextraction_extract_method_9_2 -- -package extract - -type A struct { - x int - y int -} - -func (a *A) XLessThanYP() bool { - return a.newMethod() //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a *A) newMethod() bool { - return a.x < a.y -} - -func (a *A) AddP() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - -func (a A) XLessThanY() bool { - return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y") -} - -func (a A) Add() int { - sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y") - return sum //@extractmethod("return", "sum"),extractfunc("return", "sum") -} - diff --git a/internal/lsp/testdata/extract/extract_variable/extract_basic_lit.go b/internal/lsp/testdata/extract/extract_variable/extract_basic_lit.go deleted file mode 100644 index c49e5d6a0..000000000 --- a/internal/lsp/testdata/extract/extract_variable/extract_basic_lit.go +++ /dev/null @@ -1,6 +0,0 @@ -package extract - -func _() { - var _ = 1 + 2 //@suggestedfix("1", "refactor.extract") - var _ = 3 + 4 //@suggestedfix("3 + 4", "refactor.extract") -} diff --git a/internal/lsp/testdata/extract/extract_variable/extract_basic_lit.go.golden b/internal/lsp/testdata/extract/extract_variable/extract_basic_lit.go.golden deleted file mode 100644 index 00ee7b4f9..000000000 --- a/internal/lsp/testdata/extract/extract_variable/extract_basic_lit.go.golden +++ /dev/null @@ -1,18 +0,0 @@ --- suggestedfix_extract_basic_lit_4_10 -- -package extract - -func _() { - x := 1 - var _ = x + 2 //@suggestedfix("1", "refactor.extract") - var _ = 3 + 4 //@suggestedfix("3 + 4", "refactor.extract") -} - --- suggestedfix_extract_basic_lit_5_10 -- -package extract - -func _() { - var _ = 1 + 2 //@suggestedfix("1", "refactor.extract") - x := 3 + 4 - var _ = x //@suggestedfix("3 + 4", "refactor.extract") -} - diff --git a/internal/lsp/testdata/extract/extract_variable/extract_func_call.go b/internal/lsp/testdata/extract/extract_variable/extract_func_call.go deleted file mode 100644 index badc010dc..000000000 --- a/internal/lsp/testdata/extract/extract_variable/extract_func_call.go +++ /dev/null @@ -1,9 +0,0 @@ -package extract - -import "strconv" - -func _() { - x0 := append([]int{}, 1) //@suggestedfix("append([]int{}, 1)", "refactor.extract") - str := "1" - b, err := strconv.Atoi(str) //@suggestedfix("strconv.Atoi(str)", "refactor.extract") -} diff --git a/internal/lsp/testdata/extract/extract_variable/extract_func_call.go.golden b/internal/lsp/testdata/extract/extract_variable/extract_func_call.go.golden deleted file mode 100644 index 74df67ee6..000000000 --- a/internal/lsp/testdata/extract/extract_variable/extract_func_call.go.golden +++ /dev/null @@ -1,36 +0,0 @@ --- suggestedfix_extract_func_call_6_7 -- -package extract - -import "strconv" - -func _() { - x0 := append([]int{}, 1) - a := x0 //@suggestedfix("append([]int{}, 1)", "refactor.extract") - str := "1" - b, err := strconv.Atoi(str) //@suggestedfix("strconv.Atoi(str)", "refactor.extract") -} - --- suggestedfix_extract_func_call_6_8 -- -package extract - -import "strconv" - -func _() { - x := append([]int{}, 1) - x0 := x //@suggestedfix("append([]int{}, 1)", "refactor.extract") - str := "1" - b, err := strconv.Atoi(str) //@suggestedfix("strconv.Atoi(str)", "refactor.extract") -} - --- suggestedfix_extract_func_call_8_12 -- -package extract - -import "strconv" - -func _() { - x0 := append([]int{}, 1) //@suggestedfix("append([]int{}, 1)", "refactor.extract") - str := "1" - x, x1 := strconv.Atoi(str) - b, err := x, x1 //@suggestedfix("strconv.Atoi(str)", "refactor.extract") -} - diff --git a/internal/lsp/testdata/extract/extract_variable/extract_scope.go b/internal/lsp/testdata/extract/extract_variable/extract_scope.go deleted file mode 100644 index 5dfcc3620..000000000 --- a/internal/lsp/testdata/extract/extract_variable/extract_scope.go +++ /dev/null @@ -1,13 +0,0 @@ -package extract - -import "go/ast" - -func _() { - x0 := 0 - if true { - y := ast.CompositeLit{} //@suggestedfix("ast.CompositeLit{}", "refactor.extract") - } - if true { - x1 := !false //@suggestedfix("!false", "refactor.extract") - } -} diff --git a/internal/lsp/testdata/extract/extract_variable/extract_scope.go.golden b/internal/lsp/testdata/extract/extract_variable/extract_scope.go.golden deleted file mode 100644 index e0e6464b5..000000000 --- a/internal/lsp/testdata/extract/extract_variable/extract_scope.go.golden +++ /dev/null @@ -1,32 +0,0 @@ --- suggestedfix_extract_scope_11_9 -- -package extract - -import "go/ast" - -func _() { - x0 := 0 - if true { - y := ast.CompositeLit{} //@suggestedfix("ast.CompositeLit{}", "refactor.extract") - } - if true { - x := !false - x1 := x //@suggestedfix("!false", "refactor.extract") - } -} - --- suggestedfix_extract_scope_8_8 -- -package extract - -import "go/ast" - -func _() { - x0 := 0 - if true { - x := ast.CompositeLit{} - y := x //@suggestedfix("ast.CompositeLit{}", "refactor.extract") - } - if true { - x1 := !false //@suggestedfix("!false", "refactor.extract") - } -} - diff --git a/internal/lsp/testdata/fieldlist/field_list.go b/internal/lsp/testdata/fieldlist/field_list.go deleted file mode 100644 index e687defb1..000000000 --- a/internal/lsp/testdata/fieldlist/field_list.go +++ /dev/null @@ -1,27 +0,0 @@ -package fieldlist - -var myInt int //@item(flVar, "myInt", "int", "var") -type myType int //@item(flType, "myType", "int", "type") - -func (my) _() {} //@complete(") _", flType) -func (my my) _() {} //@complete(" my)"),complete(") _", flType) - -func (myType) _() {} //@complete(") {", flType) - -func (myType) _(my my) {} //@complete(" my)"),complete(") {", flType) - -func (myType) _() my {} //@complete(" {", flType) - -func (myType) _() (my my) {} //@complete(" my"),complete(") {", flType) - -func _() { - var _ struct { - //@complete("", flType) - m my //@complete(" my"),complete(" //", flType) - } - - var _ interface { - //@complete("", flType) - m() my //@complete("("),complete(" //", flType) - } -} diff --git a/internal/lsp/testdata/fillstruct/a.go b/internal/lsp/testdata/fillstruct/a.go deleted file mode 100644 index 5c6df6c4a..000000000 --- a/internal/lsp/testdata/fillstruct/a.go +++ /dev/null @@ -1,27 +0,0 @@ -package fillstruct - -import ( - "golang.org/x/tools/internal/lsp/fillstruct/data" -) - -type basicStruct struct { - foo int -} - -var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite") - -type twoArgStruct struct { - foo int - bar string -} - -var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite") - -type nestedStruct struct { - bar string - basic basicStruct -} - -var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite") - -var _ = data.B{} //@suggestedfix("}", "refactor.rewrite") diff --git a/internal/lsp/testdata/fillstruct/a.go.golden b/internal/lsp/testdata/fillstruct/a.go.golden deleted file mode 100644 index 5d6dbceb2..000000000 --- a/internal/lsp/testdata/fillstruct/a.go.golden +++ /dev/null @@ -1,126 +0,0 @@ --- suggestedfix_a_11_21 -- -package fillstruct - -import ( - "golang.org/x/tools/internal/lsp/fillstruct/data" -) - -type basicStruct struct { - foo int -} - -var _ = basicStruct{ - foo: 0, -} //@suggestedfix("}", "refactor.rewrite") - -type twoArgStruct struct { - foo int - bar string -} - -var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite") - -type nestedStruct struct { - bar string - basic basicStruct -} - -var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite") - -var _ = data.B{} //@suggestedfix("}", "refactor.rewrite") - --- suggestedfix_a_18_22 -- -package fillstruct - -import ( - "golang.org/x/tools/internal/lsp/fillstruct/data" -) - -type basicStruct struct { - foo int -} - -var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite") - -type twoArgStruct struct { - foo int - bar string -} - -var _ = twoArgStruct{ - foo: 0, - bar: "", -} //@suggestedfix("}", "refactor.rewrite") - -type nestedStruct struct { - bar string - basic basicStruct -} - -var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite") - -var _ = data.B{} //@suggestedfix("}", "refactor.rewrite") - --- suggestedfix_a_25_22 -- -package fillstruct - -import ( - "golang.org/x/tools/internal/lsp/fillstruct/data" -) - -type basicStruct struct { - foo int -} - -var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite") - -type twoArgStruct struct { - foo int - bar string -} - -var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite") - -type nestedStruct struct { - bar string - basic basicStruct -} - -var _ = nestedStruct{ - bar: "", - basic: basicStruct{}, -} //@suggestedfix("}", "refactor.rewrite") - -var _ = data.B{} //@suggestedfix("}", "refactor.rewrite") - --- suggestedfix_a_27_16 -- -package fillstruct - -import ( - "golang.org/x/tools/internal/lsp/fillstruct/data" -) - -type basicStruct struct { - foo int -} - -var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite") - -type twoArgStruct struct { - foo int - bar string -} - -var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite") - -type nestedStruct struct { - bar string - basic basicStruct -} - -var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite") - -var _ = data.B{ - ExportedInt: 0, -} //@suggestedfix("}", "refactor.rewrite") - diff --git a/internal/lsp/testdata/fillstruct/a2.go b/internal/lsp/testdata/fillstruct/a2.go deleted file mode 100644 index 8e12a6b54..000000000 --- a/internal/lsp/testdata/fillstruct/a2.go +++ /dev/null @@ -1,29 +0,0 @@ -package fillstruct - -type typedStruct struct { - m map[string]int - s []int - c chan int - c1 <-chan int - a [2]string -} - -var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite") - -type funStruct struct { - fn func(i int) int -} - -var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite") - -type funStructCompex struct { - fn func(i int, s string) (string, int) -} - -var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite") - -type funStructEmpty struct { - fn func() -} - -var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite") diff --git a/internal/lsp/testdata/fillstruct/a2.go.golden b/internal/lsp/testdata/fillstruct/a2.go.golden deleted file mode 100644 index 78a6ee2b6..000000000 --- a/internal/lsp/testdata/fillstruct/a2.go.golden +++ /dev/null @@ -1,139 +0,0 @@ --- suggestedfix_a2_11_21 -- -package fillstruct - -type typedStruct struct { - m map[string]int - s []int - c chan int - c1 <-chan int - a [2]string -} - -var _ = typedStruct{ - m: map[string]int{}, - s: []int{}, - c: make(chan int), - c1: make(<-chan int), - a: [2]string{}, -} //@suggestedfix("}", "refactor.rewrite") - -type funStruct struct { - fn func(i int) int -} - -var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite") - -type funStructCompex struct { - fn func(i int, s string) (string, int) -} - -var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite") - -type funStructEmpty struct { - fn func() -} - -var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite") - --- suggestedfix_a2_17_19 -- -package fillstruct - -type typedStruct struct { - m map[string]int - s []int - c chan int - c1 <-chan int - a [2]string -} - -var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite") - -type funStruct struct { - fn func(i int) int -} - -var _ = funStruct{ - fn: func(i int) int { - }, -} //@suggestedfix("}", "refactor.rewrite") - -type funStructCompex struct { - fn func(i int, s string) (string, int) -} - -var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite") - -type funStructEmpty struct { - fn func() -} - -var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite") - --- suggestedfix_a2_23_25 -- -package fillstruct - -type typedStruct struct { - m map[string]int - s []int - c chan int - c1 <-chan int - a [2]string -} - -var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite") - -type funStruct struct { - fn func(i int) int -} - -var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite") - -type funStructCompex struct { - fn func(i int, s string) (string, int) -} - -var _ = funStructCompex{ - fn: func(i int, s string) (string, int) { - }, -} //@suggestedfix("}", "refactor.rewrite") - -type funStructEmpty struct { - fn func() -} - -var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite") - --- suggestedfix_a2_29_24 -- -package fillstruct - -type typedStruct struct { - m map[string]int - s []int - c chan int - c1 <-chan int - a [2]string -} - -var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite") - -type funStruct struct { - fn func(i int) int -} - -var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite") - -type funStructCompex struct { - fn func(i int, s string) (string, int) -} - -var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite") - -type funStructEmpty struct { - fn func() -} - -var _ = funStructEmpty{ - fn: func() { - }, -} //@suggestedfix("}", "refactor.rewrite") - diff --git a/internal/lsp/testdata/fillstruct/a3.go b/internal/lsp/testdata/fillstruct/a3.go deleted file mode 100644 index 730db3054..000000000 --- a/internal/lsp/testdata/fillstruct/a3.go +++ /dev/null @@ -1,42 +0,0 @@ -package fillstruct - -import ( - "go/ast" - "go/token" -) - -type Foo struct { - A int -} - -type Bar struct { - X *Foo - Y *Foo -} - -var _ = Bar{} //@suggestedfix("}", "refactor.rewrite") - -type importedStruct struct { - m map[*ast.CompositeLit]ast.Field - s []ast.BadExpr - a [3]token.Token - c chan ast.EmptyStmt - fn func(ast_decl ast.DeclStmt) ast.Ellipsis - st ast.CompositeLit -} - -var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite") - -type pointerBuiltinStruct struct { - b *bool - s *string - i *int -} - -var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite") - -var _ = []ast.BasicLit{ - {}, //@suggestedfix("}", "refactor.rewrite") -} - -var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite") diff --git a/internal/lsp/testdata/fillstruct/a3.go.golden b/internal/lsp/testdata/fillstruct/a3.go.golden deleted file mode 100644 index 1d8672927..000000000 --- a/internal/lsp/testdata/fillstruct/a3.go.golden +++ /dev/null @@ -1,243 +0,0 @@ --- suggestedfix_a3_17_13 -- -package fillstruct - -import ( - "go/ast" - "go/token" -) - -type Foo struct { - A int -} - -type Bar struct { - X *Foo - Y *Foo -} - -var _ = Bar{ - X: &Foo{}, - Y: &Foo{}, -} //@suggestedfix("}", "refactor.rewrite") - -type importedStruct struct { - m map[*ast.CompositeLit]ast.Field - s []ast.BadExpr - a [3]token.Token - c chan ast.EmptyStmt - fn func(ast_decl ast.DeclStmt) ast.Ellipsis - st ast.CompositeLit -} - -var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite") - -type pointerBuiltinStruct struct { - b *bool - s *string - i *int -} - -var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite") - -var _ = []ast.BasicLit{ - {}, //@suggestedfix("}", "refactor.rewrite") -} - -var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite") - --- suggestedfix_a3_28_24 -- -package fillstruct - -import ( - "go/ast" - "go/token" -) - -type Foo struct { - A int -} - -type Bar struct { - X *Foo - Y *Foo -} - -var _ = Bar{} //@suggestedfix("}", "refactor.rewrite") - -type importedStruct struct { - m map[*ast.CompositeLit]ast.Field - s []ast.BadExpr - a [3]token.Token - c chan ast.EmptyStmt - fn func(ast_decl ast.DeclStmt) ast.Ellipsis - st ast.CompositeLit -} - -var _ = importedStruct{ - m: map[*ast.CompositeLit]ast.Field{}, - s: []ast.BadExpr{}, - a: [3]token.Token{}, - c: make(chan ast.EmptyStmt), - fn: func(ast_decl ast.DeclStmt) ast.Ellipsis { - }, - st: ast.CompositeLit{}, -} //@suggestedfix("}", "refactor.rewrite") - -type pointerBuiltinStruct struct { - b *bool - s *string - i *int -} - -var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite") - -var _ = []ast.BasicLit{ - {}, //@suggestedfix("}", "refactor.rewrite") -} - -var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite") - --- suggestedfix_a3_36_30 -- -package fillstruct - -import ( - "go/ast" - "go/token" -) - -type Foo struct { - A int -} - -type Bar struct { - X *Foo - Y *Foo -} - -var _ = Bar{} //@suggestedfix("}", "refactor.rewrite") - -type importedStruct struct { - m map[*ast.CompositeLit]ast.Field - s []ast.BadExpr - a [3]token.Token - c chan ast.EmptyStmt - fn func(ast_decl ast.DeclStmt) ast.Ellipsis - st ast.CompositeLit -} - -var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite") - -type pointerBuiltinStruct struct { - b *bool - s *string - i *int -} - -var _ = pointerBuiltinStruct{ - b: new(bool), - s: new(string), - i: new(int), -} //@suggestedfix("}", "refactor.rewrite") - -var _ = []ast.BasicLit{ - {}, //@suggestedfix("}", "refactor.rewrite") -} - -var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite") - --- suggestedfix_a3_39_3 -- -package fillstruct - -import ( - "go/ast" - "go/token" -) - -type Foo struct { - A int -} - -type Bar struct { - X *Foo - Y *Foo -} - -var _ = Bar{} //@suggestedfix("}", "refactor.rewrite") - -type importedStruct struct { - m map[*ast.CompositeLit]ast.Field - s []ast.BadExpr - a [3]token.Token - c chan ast.EmptyStmt - fn func(ast_decl ast.DeclStmt) ast.Ellipsis - st ast.CompositeLit -} - -var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite") - -type pointerBuiltinStruct struct { - b *bool - s *string - i *int -} - -var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite") - -var _ = []ast.BasicLit{ - { - ValuePos: 0, - Kind: 0, - Value: "", - }, //@suggestedfix("}", "refactor.rewrite") -} - -var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite") - --- suggestedfix_a3_42_25 -- -package fillstruct - -import ( - "go/ast" - "go/token" -) - -type Foo struct { - A int -} - -type Bar struct { - X *Foo - Y *Foo -} - -var _ = Bar{} //@suggestedfix("}", "refactor.rewrite") - -type importedStruct struct { - m map[*ast.CompositeLit]ast.Field - s []ast.BadExpr - a [3]token.Token - c chan ast.EmptyStmt - fn func(ast_decl ast.DeclStmt) ast.Ellipsis - st ast.CompositeLit -} - -var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite") - -type pointerBuiltinStruct struct { - b *bool - s *string - i *int -} - -var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite") - -var _ = []ast.BasicLit{ - {}, //@suggestedfix("}", "refactor.rewrite") -} - -var _ = []ast.BasicLit{{ - ValuePos: 0, - Kind: 0, - Value: "", -}} //@suggestedfix("}", "refactor.rewrite") - diff --git a/internal/lsp/testdata/fillstruct/a4.go b/internal/lsp/testdata/fillstruct/a4.go deleted file mode 100644 index 7833d338c..000000000 --- a/internal/lsp/testdata/fillstruct/a4.go +++ /dev/null @@ -1,39 +0,0 @@ -package fillstruct - -import "go/ast" - -type iStruct struct { - X int -} - -type sStruct struct { - str string -} - -type multiFill struct { - num int - strin string - arr []int -} - -type assignStruct struct { - n ast.Node -} - -func fill() { - var x int - var _ = iStruct{} //@suggestedfix("}", "refactor.rewrite") - - var s string - var _ = sStruct{} //@suggestedfix("}", "refactor.rewrite") - - var n int - _ = []int{} - if true { - arr := []int{1, 2} - } - var _ = multiFill{} //@suggestedfix("}", "refactor.rewrite") - - var node *ast.CompositeLit - var _ = assignStruct{} //@suggestedfix("}", "refactor.rewrite") -} diff --git a/internal/lsp/testdata/fillstruct/a4.go.golden b/internal/lsp/testdata/fillstruct/a4.go.golden deleted file mode 100644 index 109c6b5ea..000000000 --- a/internal/lsp/testdata/fillstruct/a4.go.golden +++ /dev/null @@ -1,174 +0,0 @@ --- suggestedfix_a4_25_18 -- -package fillstruct - -import "go/ast" - -type iStruct struct { - X int -} - -type sStruct struct { - str string -} - -type multiFill struct { - num int - strin string - arr []int -} - -type assignStruct struct { - n ast.Node -} - -func fill() { - var x int - var _ = iStruct{ - X: x, - } //@suggestedfix("}", "refactor.rewrite") - - var s string - var _ = sStruct{} //@suggestedfix("}", "refactor.rewrite") - - var n int - _ = []int{} - if true { - arr := []int{1, 2} - } - var _ = multiFill{} //@suggestedfix("}", "refactor.rewrite") - - var node *ast.CompositeLit - var _ = assignStruct{} //@suggestedfix("}", "refactor.rewrite") -} - --- suggestedfix_a4_28_18 -- -package fillstruct - -import "go/ast" - -type iStruct struct { - X int -} - -type sStruct struct { - str string -} - -type multiFill struct { - num int - strin string - arr []int -} - -type assignStruct struct { - n ast.Node -} - -func fill() { - var x int - var _ = iStruct{} //@suggestedfix("}", "refactor.rewrite") - - var s string - var _ = sStruct{ - str: s, - } //@suggestedfix("}", "refactor.rewrite") - - var n int - _ = []int{} - if true { - arr := []int{1, 2} - } - var _ = multiFill{} //@suggestedfix("}", "refactor.rewrite") - - var node *ast.CompositeLit - var _ = assignStruct{} //@suggestedfix("}", "refactor.rewrite") -} - --- suggestedfix_a4_35_20 -- -package fillstruct - -import "go/ast" - -type iStruct struct { - X int -} - -type sStruct struct { - str string -} - -type multiFill struct { - num int - strin string - arr []int -} - -type assignStruct struct { - n ast.Node -} - -func fill() { - var x int - var _ = iStruct{} //@suggestedfix("}", "refactor.rewrite") - - var s string - var _ = sStruct{} //@suggestedfix("}", "refactor.rewrite") - - var n int - _ = []int{} - if true { - arr := []int{1, 2} - } - var _ = multiFill{ - num: n, - strin: s, - arr: []int{}, - } //@suggestedfix("}", "refactor.rewrite") - - var node *ast.CompositeLit - var _ = assignStruct{} //@suggestedfix("}", "refactor.rewrite") -} - --- suggestedfix_a4_38_23 -- -package fillstruct - -import "go/ast" - -type iStruct struct { - X int -} - -type sStruct struct { - str string -} - -type multiFill struct { - num int - strin string - arr []int -} - -type assignStruct struct { - n ast.Node -} - -func fill() { - var x int - var _ = iStruct{} //@suggestedfix("}", "refactor.rewrite") - - var s string - var _ = sStruct{} //@suggestedfix("}", "refactor.rewrite") - - var n int - _ = []int{} - if true { - arr := []int{1, 2} - } - var _ = multiFill{} //@suggestedfix("}", "refactor.rewrite") - - var node *ast.CompositeLit - var _ = assignStruct{ - n: node, - } //@suggestedfix("}", "refactor.rewrite") -} - diff --git a/internal/lsp/testdata/fillstruct/data/a.go b/internal/lsp/testdata/fillstruct/data/a.go deleted file mode 100644 index 7ca37736b..000000000 --- a/internal/lsp/testdata/fillstruct/data/a.go +++ /dev/null @@ -1,6 +0,0 @@ -package data
-
-type B struct {
- ExportedInt int
- unexportedInt int
-}
diff --git a/internal/lsp/testdata/fillstruct/fill_struct.go b/internal/lsp/testdata/fillstruct/fill_struct.go deleted file mode 100644 index fccec1353..000000000 --- a/internal/lsp/testdata/fillstruct/fill_struct.go +++ /dev/null @@ -1,26 +0,0 @@ -package fillstruct - -type StructA struct { - unexportedIntField int - ExportedIntField int - MapA map[int]string - Array []int - StructB -} - -type StructA2 struct { - B *StructB -} - -type StructA3 struct { - B StructB -} - -func fill() { - a := StructA{} //@suggestedfix("}", "refactor.rewrite") - b := StructA2{} //@suggestedfix("}", "refactor.rewrite") - c := StructA3{} //@suggestedfix("}", "refactor.rewrite") - if true { - _ = StructA3{} //@suggestedfix("}", "refactor.rewrite") - } -} diff --git a/internal/lsp/testdata/fillstruct/fill_struct.go.golden b/internal/lsp/testdata/fillstruct/fill_struct.go.golden deleted file mode 100644 index 8d9970315..000000000 --- a/internal/lsp/testdata/fillstruct/fill_struct.go.golden +++ /dev/null @@ -1,124 +0,0 @@ --- suggestedfix_fill_struct_20_15 -- -package fillstruct - -type StructA struct { - unexportedIntField int - ExportedIntField int - MapA map[int]string - Array []int - StructB -} - -type StructA2 struct { - B *StructB -} - -type StructA3 struct { - B StructB -} - -func fill() { - a := StructA{ - unexportedIntField: 0, - ExportedIntField: 0, - MapA: map[int]string{}, - Array: []int{}, - StructB: StructB{}, - } //@suggestedfix("}", "refactor.rewrite") - b := StructA2{} //@suggestedfix("}", "refactor.rewrite") - c := StructA3{} //@suggestedfix("}", "refactor.rewrite") - if true { - _ = StructA3{} //@suggestedfix("}", "refactor.rewrite") - } -} - --- suggestedfix_fill_struct_21_16 -- -package fillstruct - -type StructA struct { - unexportedIntField int - ExportedIntField int - MapA map[int]string - Array []int - StructB -} - -type StructA2 struct { - B *StructB -} - -type StructA3 struct { - B StructB -} - -func fill() { - a := StructA{} //@suggestedfix("}", "refactor.rewrite") - b := StructA2{ - B: &StructB{}, - } //@suggestedfix("}", "refactor.rewrite") - c := StructA3{} //@suggestedfix("}", "refactor.rewrite") - if true { - _ = StructA3{} //@suggestedfix("}", "refactor.rewrite") - } -} - --- suggestedfix_fill_struct_22_16 -- -package fillstruct - -type StructA struct { - unexportedIntField int - ExportedIntField int - MapA map[int]string - Array []int - StructB -} - -type StructA2 struct { - B *StructB -} - -type StructA3 struct { - B StructB -} - -func fill() { - a := StructA{} //@suggestedfix("}", "refactor.rewrite") - b := StructA2{} //@suggestedfix("}", "refactor.rewrite") - c := StructA3{ - B: StructB{}, - } //@suggestedfix("}", "refactor.rewrite") - if true { - _ = StructA3{} //@suggestedfix("}", "refactor.rewrite") - } -} - --- suggestedfix_fill_struct_24_16 -- -package fillstruct - -type StructA struct { - unexportedIntField int - ExportedIntField int - MapA map[int]string - Array []int - StructB -} - -type StructA2 struct { - B *StructB -} - -type StructA3 struct { - B StructB -} - -func fill() { - a := StructA{} //@suggestedfix("}", "refactor.rewrite") - b := StructA2{} //@suggestedfix("}", "refactor.rewrite") - c := StructA3{} //@suggestedfix("}", "refactor.rewrite") - if true { - _ = StructA3{ - B: StructB{}, - } //@suggestedfix("}", "refactor.rewrite") - } -} - diff --git a/internal/lsp/testdata/fillstruct/fill_struct_anon.go b/internal/lsp/testdata/fillstruct/fill_struct_anon.go deleted file mode 100644 index b5d2337fd..000000000 --- a/internal/lsp/testdata/fillstruct/fill_struct_anon.go +++ /dev/null @@ -1,14 +0,0 @@ -package fillstruct - -type StructAnon struct { - a struct{} - b map[string]interface{} - c map[string]struct { - d int - e bool - } -} - -func fill() { - _ := StructAnon{} //@suggestedfix("}", "refactor.rewrite") -} diff --git a/internal/lsp/testdata/fillstruct/fill_struct_anon.go.golden b/internal/lsp/testdata/fillstruct/fill_struct_anon.go.golden deleted file mode 100644 index eb6ffd661..000000000 --- a/internal/lsp/testdata/fillstruct/fill_struct_anon.go.golden +++ /dev/null @@ -1,20 +0,0 @@ --- suggestedfix_fill_struct_anon_13_18 -- -package fillstruct - -type StructAnon struct { - a struct{} - b map[string]interface{} - c map[string]struct { - d int - e bool - } -} - -func fill() { - _ := StructAnon{ - a: struct{}{}, - b: map[string]interface{}{}, - c: map[string]struct{d int; e bool}{}, - } //@suggestedfix("}", "refactor.rewrite") -} - diff --git a/internal/lsp/testdata/fillstruct/fill_struct_nested.go b/internal/lsp/testdata/fillstruct/fill_struct_nested.go deleted file mode 100644 index 79eb84b74..000000000 --- a/internal/lsp/testdata/fillstruct/fill_struct_nested.go +++ /dev/null @@ -1,15 +0,0 @@ -package fillstruct - -type StructB struct { - StructC -} - -type StructC struct { - unexportedInt int -} - -func nested() { - c := StructB{ - StructC: StructC{}, //@suggestedfix("}", "refactor.rewrite") - } -} diff --git a/internal/lsp/testdata/fillstruct/fill_struct_nested.go.golden b/internal/lsp/testdata/fillstruct/fill_struct_nested.go.golden deleted file mode 100644 index 30061a5d7..000000000 --- a/internal/lsp/testdata/fillstruct/fill_struct_nested.go.golden +++ /dev/null @@ -1,19 +0,0 @@ --- suggestedfix_fill_struct_nested_13_20 -- -package fillstruct - -type StructB struct { - StructC -} - -type StructC struct { - unexportedInt int -} - -func nested() { - c := StructB{ - StructC: StructC{ - unexportedInt: 0, - }, //@suggestedfix("}", "refactor.rewrite") - } -} - diff --git a/internal/lsp/testdata/fillstruct/fill_struct_package.go b/internal/lsp/testdata/fillstruct/fill_struct_package.go deleted file mode 100644 index 71f124858..000000000 --- a/internal/lsp/testdata/fillstruct/fill_struct_package.go +++ /dev/null @@ -1,12 +0,0 @@ -package fillstruct - -import ( - h2 "net/http" - - "golang.org/x/tools/internal/lsp/fillstruct/data" -) - -func unexported() { - a := data.B{} //@suggestedfix("}", "refactor.rewrite") - _ = h2.Client{} //@suggestedfix("}", "refactor.rewrite") -} diff --git a/internal/lsp/testdata/fillstruct/fill_struct_package.go.golden b/internal/lsp/testdata/fillstruct/fill_struct_package.go.golden deleted file mode 100644 index 13c857025..000000000 --- a/internal/lsp/testdata/fillstruct/fill_struct_package.go.golden +++ /dev/null @@ -1,36 +0,0 @@ --- suggestedfix_fill_struct_package_10_14 -- -package fillstruct - -import ( - h2 "net/http" - - "golang.org/x/tools/internal/lsp/fillstruct/data" -) - -func unexported() { - a := data.B{ - ExportedInt: 0, - } //@suggestedfix("}", "refactor.rewrite") - _ = h2.Client{} //@suggestedfix("}", "refactor.rewrite") -} - --- suggestedfix_fill_struct_package_11_16 -- -package fillstruct - -import ( - h2 "net/http" - - "golang.org/x/tools/internal/lsp/fillstruct/data" -) - -func unexported() { - a := data.B{} //@suggestedfix("}", "refactor.rewrite") - _ = h2.Client{ - Transport: nil, - CheckRedirect: func(req *h2.Request, via []*h2.Request) error { - }, - Jar: nil, - Timeout: 0, - } //@suggestedfix("}", "refactor.rewrite") -} - diff --git a/internal/lsp/testdata/fillstruct/fill_struct_partial.go b/internal/lsp/testdata/fillstruct/fill_struct_partial.go deleted file mode 100644 index 97b517dcd..000000000 --- a/internal/lsp/testdata/fillstruct/fill_struct_partial.go +++ /dev/null @@ -1,24 +0,0 @@ -package fillstruct - -type StructPartialA struct { - PrefilledInt int - UnfilledInt int - StructPartialB -} - -type StructPartialB struct { - PrefilledInt int - UnfilledInt int -} - -func fill() { - a := StructPartialA{ - PrefilledInt: 5, - } //@suggestedfix("}", "refactor.rewrite") - b := StructPartialB{ - /* this comment should disappear */ - PrefilledInt: 7, // This comment should be blown away. - /* As should - this one */ - } //@suggestedfix("}", "refactor.rewrite") -} diff --git a/internal/lsp/testdata/fillstruct/fill_struct_partial.go.golden b/internal/lsp/testdata/fillstruct/fill_struct_partial.go.golden deleted file mode 100644 index 2d063c14d..000000000 --- a/internal/lsp/testdata/fillstruct/fill_struct_partial.go.golden +++ /dev/null @@ -1,52 +0,0 @@ --- suggestedfix_fill_struct_partial_17_2 -- -package fillstruct - -type StructPartialA struct { - PrefilledInt int - UnfilledInt int - StructPartialB -} - -type StructPartialB struct { - PrefilledInt int - UnfilledInt int -} - -func fill() { - a := StructPartialA{ - PrefilledInt: 5, - UnfilledInt: 0, - StructPartialB: StructPartialB{}, - } //@suggestedfix("}", "refactor.rewrite") - b := StructPartialB{ - /* this comment should disappear */ - PrefilledInt: 7, // This comment should be blown away. - /* As should - this one */ - } //@suggestedfix("}", "refactor.rewrite") -} - --- suggestedfix_fill_struct_partial_23_2 -- -package fillstruct - -type StructPartialA struct { - PrefilledInt int - UnfilledInt int - StructPartialB -} - -type StructPartialB struct { - PrefilledInt int - UnfilledInt int -} - -func fill() { - a := StructPartialA{ - PrefilledInt: 5, - } //@suggestedfix("}", "refactor.rewrite") - b := StructPartialB{ - PrefilledInt: 7, - UnfilledInt: 0, - } //@suggestedfix("}", "refactor.rewrite") -} - diff --git a/internal/lsp/testdata/fillstruct/fill_struct_spaces.go b/internal/lsp/testdata/fillstruct/fill_struct_spaces.go deleted file mode 100644 index d5d1bbba5..000000000 --- a/internal/lsp/testdata/fillstruct/fill_struct_spaces.go +++ /dev/null @@ -1,9 +0,0 @@ -package fillstruct - -type StructD struct { - ExportedIntField int -} - -func spaces() { - d := StructD{} //@suggestedfix("}", "refactor.rewrite") -} diff --git a/internal/lsp/testdata/fillstruct/fill_struct_spaces.go.golden b/internal/lsp/testdata/fillstruct/fill_struct_spaces.go.golden deleted file mode 100644 index 0d755334c..000000000 --- a/internal/lsp/testdata/fillstruct/fill_struct_spaces.go.golden +++ /dev/null @@ -1,13 +0,0 @@ --- suggestedfix_fill_struct_spaces_8_15 -- -package fillstruct - -type StructD struct { - ExportedIntField int -} - -func spaces() { - d := StructD{ - ExportedIntField: 0, - } //@suggestedfix("}", "refactor.rewrite") -} - diff --git a/internal/lsp/testdata/folding/a.go b/internal/lsp/testdata/folding/a.go deleted file mode 100644 index e07d7e0bf..000000000 --- a/internal/lsp/testdata/folding/a.go +++ /dev/null @@ -1,75 +0,0 @@ -package folding //@fold("package") - -import ( - "fmt" - _ "log" -) - -import _ "os" - -// bar is a function. -// With a multiline doc comment. -func bar() string { - /* This is a single line comment */ - switch { - case true: - if true { - fmt.Println("true") - } else { - fmt.Println("false") - } - case false: - fmt.Println("false") - default: - fmt.Println("default") - } - /* This is a multiline - block - comment */ - - /* This is a multiline - block - comment */ - // Followed by another comment. - _ = []int{ - 1, - 2, - 3, - } - _ = [2]string{"d", - "e", - } - _ = map[string]int{ - "a": 1, - "b": 2, - "c": 3, - } - type T struct { - f string - g int - h string - } - _ = T{ - f: "j", - g: 4, - h: "i", - } - x, y := make(chan bool), make(chan bool) - select { - case val := <-x: - if val { - fmt.Println("true from x") - } else { - fmt.Println("false from x") - } - case <-y: - fmt.Println("y") - default: - fmt.Println("default") - } - // This is a multiline comment - // that is not a doc comment. - return ` -this string -is not indented` -} diff --git a/internal/lsp/testdata/folding/a.go.golden b/internal/lsp/testdata/folding/a.go.golden deleted file mode 100644 index ce6910233..000000000 --- a/internal/lsp/testdata/folding/a.go.golden +++ /dev/null @@ -1,759 +0,0 @@ --- foldingRange-0 -- -package folding //@fold("package") - -import (<>) - -import _ "os" - -// bar is a function.<> -func bar(<>) string {<>} - --- foldingRange-1 -- -package folding //@fold("package") - -import ( - "fmt" - _ "log" -) - -import _ "os" - -// bar is a function. -// With a multiline doc comment. -func bar() string { - /* This is a single line comment */ - switch {<>} - /* This is a multiline<> - - /* This is a multiline<> - _ = []int{<>} - _ = [2]string{<>} - _ = map[string]int{<>} - type T struct {<>} - _ = T{<>} - x, y := make(<>), make(<>) - select {<>} - // This is a multiline comment<> - return <> -} - --- foldingRange-2 -- -package folding //@fold("package") - -import ( - "fmt" - _ "log" -) - -import _ "os" - -// bar is a function. -// With a multiline doc comment. -func bar() string { - /* This is a single line comment */ - switch { - case true:<> - case false:<> - default:<> - } - /* This is a multiline - block - comment */ - - /* This is a multiline - block - comment */ - // Followed by another comment. - _ = []int{ - 1, - 2, - 3, - } - _ = [2]string{"d", - "e", - } - _ = map[string]int{ - "a": 1, - "b": 2, - "c": 3, - } - type T struct { - f string - g int - h string - } - _ = T{ - f: "j", - g: 4, - h: "i", - } - x, y := make(chan bool), make(chan bool) - select { - case val := <-x:<> - case <-y:<> - default:<> - } - // This is a multiline comment - // that is not a doc comment. - return ` -this string -is not indented` -} - --- foldingRange-3 -- -package folding //@fold("package") - -import ( - "fmt" - _ "log" -) - -import _ "os" - -// bar is a function. -// With a multiline doc comment. -func bar() string { - /* This is a single line comment */ - switch { - case true: - if true {<>} else {<>} - case false: - fmt.Println(<>) - default: - fmt.Println(<>) - } - /* This is a multiline - block - comment */ - - /* This is a multiline - block - comment */ - // Followed by another comment. - _ = []int{ - 1, - 2, - 3, - } - _ = [2]string{"d", - "e", - } - _ = map[string]int{ - "a": 1, - "b": 2, - "c": 3, - } - type T struct { - f string - g int - h string - } - _ = T{ - f: "j", - g: 4, - h: "i", - } - x, y := make(chan bool), make(chan bool) - select { - case val := <-x: - if val {<>} else {<>} - case <-y: - fmt.Println(<>) - default: - fmt.Println(<>) - } - // This is a multiline comment - // that is not a doc comment. - return ` -this string -is not indented` -} - --- foldingRange-4 -- -package folding //@fold("package") - -import ( - "fmt" - _ "log" -) - -import _ "os" - -// bar is a function. -// With a multiline doc comment. -func bar() string { - /* This is a single line comment */ - switch { - case true: - if true { - fmt.Println(<>) - } else { - fmt.Println(<>) - } - case false: - fmt.Println("false") - default: - fmt.Println("default") - } - /* This is a multiline - block - comment */ - - /* This is a multiline - block - comment */ - // Followed by another comment. - _ = []int{ - 1, - 2, - 3, - } - _ = [2]string{"d", - "e", - } - _ = map[string]int{ - "a": 1, - "b": 2, - "c": 3, - } - type T struct { - f string - g int - h string - } - _ = T{ - f: "j", - g: 4, - h: "i", - } - x, y := make(chan bool), make(chan bool) - select { - case val := <-x: - if val { - fmt.Println(<>) - } else { - fmt.Println(<>) - } - case <-y: - fmt.Println("y") - default: - fmt.Println("default") - } - // This is a multiline comment - // that is not a doc comment. - return ` -this string -is not indented` -} - --- foldingRange-cmd -- -3:9-6:0 -10:22-11:32 -12:10-12:9 -12:20-75:0 -14:10-25:1 -15:12-20:3 -16:12-18:2 -17:16-17:21 -18:11-20:2 -19:16-19:22 -21:13-22:22 -22:15-22:21 -23:10-24:24 -24:15-24:23 -26:24-28:11 -30:24-33:32 -34:12-38:1 -39:16-41:1 -42:21-46:1 -47:17-51:1 -52:8-56:1 -57:15-57:23 -57:32-57:40 -58:10-69:1 -59:18-64:3 -60:11-62:2 -61:16-61:28 -62:11-64:2 -63:16-63:29 -65:11-66:18 -66:15-66:17 -67:10-68:24 -68:15-68:23 -70:32-71:30 -72:9-74:16 - --- foldingRange-comment-0 -- -package folding //@fold("package") - -import ( - "fmt" - _ "log" -) - -import _ "os" - -// bar is a function.<> -func bar() string { - /* This is a single line comment */ - switch { - case true: - if true { - fmt.Println("true") - } else { - fmt.Println("false") - } - case false: - fmt.Println("false") - default: - fmt.Println("default") - } - /* This is a multiline<> - - /* This is a multiline<> - _ = []int{ - 1, - 2, - 3, - } - _ = [2]string{"d", - "e", - } - _ = map[string]int{ - "a": 1, - "b": 2, - "c": 3, - } - type T struct { - f string - g int - h string - } - _ = T{ - f: "j", - g: 4, - h: "i", - } - x, y := make(chan bool), make(chan bool) - select { - case val := <-x: - if val { - fmt.Println("true from x") - } else { - fmt.Println("false from x") - } - case <-y: - fmt.Println("y") - default: - fmt.Println("default") - } - // This is a multiline comment<> - return ` -this string -is not indented` -} - --- foldingRange-imports-0 -- -package folding //@fold("package") - -import (<>) - -import _ "os" - -// bar is a function. -// With a multiline doc comment. -func bar() string { - /* This is a single line comment */ - switch { - case true: - if true { - fmt.Println("true") - } else { - fmt.Println("false") - } - case false: - fmt.Println("false") - default: - fmt.Println("default") - } - /* This is a multiline - block - comment */ - - /* This is a multiline - block - comment */ - // Followed by another comment. - _ = []int{ - 1, - 2, - 3, - } - _ = [2]string{"d", - "e", - } - _ = map[string]int{ - "a": 1, - "b": 2, - "c": 3, - } - type T struct { - f string - g int - h string - } - _ = T{ - f: "j", - g: 4, - h: "i", - } - x, y := make(chan bool), make(chan bool) - select { - case val := <-x: - if val { - fmt.Println("true from x") - } else { - fmt.Println("false from x") - } - case <-y: - fmt.Println("y") - default: - fmt.Println("default") - } - // This is a multiline comment - // that is not a doc comment. - return ` -this string -is not indented` -} - --- foldingRange-lineFolding-0 -- -package folding //@fold("package") - -import (<> -) - -import _ "os" - -// bar is a function.<> -func bar() string {<> -} - --- foldingRange-lineFolding-1 -- -package folding //@fold("package") - -import ( - "fmt" - _ "log" -) - -import _ "os" - -// bar is a function. -// With a multiline doc comment. -func bar() string { - /* This is a single line comment */ - switch {<> - } - /* This is a multiline<> - - /* This is a multiline<> - _ = []int{<>, - } - _ = [2]string{"d", - "e", - } - _ = map[string]int{<>, - } - type T struct {<> - } - _ = T{<>, - } - x, y := make(chan bool), make(chan bool) - select {<> - } - // This is a multiline comment<> - return <> -} - --- foldingRange-lineFolding-2 -- -package folding //@fold("package") - -import ( - "fmt" - _ "log" -) - -import _ "os" - -// bar is a function. -// With a multiline doc comment. -func bar() string { - /* This is a single line comment */ - switch { - case true:<> - case false:<> - default:<> - } - /* This is a multiline - block - comment */ - - /* This is a multiline - block - comment */ - // Followed by another comment. - _ = []int{ - 1, - 2, - 3, - } - _ = [2]string{"d", - "e", - } - _ = map[string]int{ - "a": 1, - "b": 2, - "c": 3, - } - type T struct { - f string - g int - h string - } - _ = T{ - f: "j", - g: 4, - h: "i", - } - x, y := make(chan bool), make(chan bool) - select { - case val := <-x:<> - case <-y:<> - default:<> - } - // This is a multiline comment - // that is not a doc comment. - return ` -this string -is not indented` -} - --- foldingRange-lineFolding-3 -- -package folding //@fold("package") - -import ( - "fmt" - _ "log" -) - -import _ "os" - -// bar is a function. -// With a multiline doc comment. -func bar() string { - /* This is a single line comment */ - switch { - case true: - if true {<> - } else {<> - } - case false: - fmt.Println("false") - default: - fmt.Println("default") - } - /* This is a multiline - block - comment */ - - /* This is a multiline - block - comment */ - // Followed by another comment. - _ = []int{ - 1, - 2, - 3, - } - _ = [2]string{"d", - "e", - } - _ = map[string]int{ - "a": 1, - "b": 2, - "c": 3, - } - type T struct { - f string - g int - h string - } - _ = T{ - f: "j", - g: 4, - h: "i", - } - x, y := make(chan bool), make(chan bool) - select { - case val := <-x: - if val {<> - } else {<> - } - case <-y: - fmt.Println("y") - default: - fmt.Println("default") - } - // This is a multiline comment - // that is not a doc comment. - return ` -this string -is not indented` -} - --- foldingRange-lineFolding-comment-0 -- -package folding //@fold("package") - -import ( - "fmt" - _ "log" -) - -import _ "os" - -// bar is a function.<> -func bar() string { - /* This is a single line comment */ - switch { - case true: - if true { - fmt.Println("true") - } else { - fmt.Println("false") - } - case false: - fmt.Println("false") - default: - fmt.Println("default") - } - /* This is a multiline<> - - /* This is a multiline<> - _ = []int{ - 1, - 2, - 3, - } - _ = [2]string{"d", - "e", - } - _ = map[string]int{ - "a": 1, - "b": 2, - "c": 3, - } - type T struct { - f string - g int - h string - } - _ = T{ - f: "j", - g: 4, - h: "i", - } - x, y := make(chan bool), make(chan bool) - select { - case val := <-x: - if val { - fmt.Println("true from x") - } else { - fmt.Println("false from x") - } - case <-y: - fmt.Println("y") - default: - fmt.Println("default") - } - // This is a multiline comment<> - return ` -this string -is not indented` -} - --- foldingRange-lineFolding-imports-0 -- -package folding //@fold("package") - -import (<> -) - -import _ "os" - -// bar is a function. -// With a multiline doc comment. -func bar() string { - /* This is a single line comment */ - switch { - case true: - if true { - fmt.Println("true") - } else { - fmt.Println("false") - } - case false: - fmt.Println("false") - default: - fmt.Println("default") - } - /* This is a multiline - block - comment */ - - /* This is a multiline - block - comment */ - // Followed by another comment. - _ = []int{ - 1, - 2, - 3, - } - _ = [2]string{"d", - "e", - } - _ = map[string]int{ - "a": 1, - "b": 2, - "c": 3, - } - type T struct { - f string - g int - h string - } - _ = T{ - f: "j", - g: 4, - h: "i", - } - x, y := make(chan bool), make(chan bool) - select { - case val := <-x: - if val { - fmt.Println("true from x") - } else { - fmt.Println("false from x") - } - case <-y: - fmt.Println("y") - default: - fmt.Println("default") - } - // This is a multiline comment - // that is not a doc comment. - return ` -this string -is not indented` -} - diff --git a/internal/lsp/testdata/folding/bad.go.golden b/internal/lsp/testdata/folding/bad.go.golden deleted file mode 100644 index d1bdfec60..000000000 --- a/internal/lsp/testdata/folding/bad.go.golden +++ /dev/null @@ -1,91 +0,0 @@ --- foldingRange-0 -- -package folding //@fold("package") - -import (<>) - -import (<>) - -// badBar is a function. -func badBar(<>) string {<>} - --- foldingRange-1 -- -package folding //@fold("package") - -import ( "fmt" - _ "log" -) - -import ( - _ "os" ) - -// badBar is a function. -func badBar() string { x := true - if x {<>} else {<>} - return -} - --- foldingRange-2 -- -package folding //@fold("package") - -import ( "fmt" - _ "log" -) - -import ( - _ "os" ) - -// badBar is a function. -func badBar() string { x := true - if x { - // This is the only foldable thing in this file when lineFoldingOnly - fmt.Println(<>) - } else { - fmt.Println(<>) } - return -} - --- foldingRange-cmd -- -3:9-5:0 -7:9-8:8 -11:13-11:12 -11:23-18:0 -12:8-15:1 -14:15-14:20 -15:10-16:23 -16:15-16:21 - --- foldingRange-imports-0 -- -package folding //@fold("package") - -import (<>) - -import (<>) - -// badBar is a function. -func badBar() string { x := true - if x { - // This is the only foldable thing in this file when lineFoldingOnly - fmt.Println("true") - } else { - fmt.Println("false") } - return -} - --- foldingRange-lineFolding-0 -- -package folding //@fold("package") - -import ( "fmt" - _ "log" -) - -import ( - _ "os" ) - -// badBar is a function. -func badBar() string { x := true - if x {<> - } else { - fmt.Println("false") } - return -} - diff --git a/internal/lsp/testdata/folding/bad.go.in b/internal/lsp/testdata/folding/bad.go.in deleted file mode 100644 index 84fcb740f..000000000 --- a/internal/lsp/testdata/folding/bad.go.in +++ /dev/null @@ -1,18 +0,0 @@ -package folding //@fold("package") - -import ( "fmt" - _ "log" -) - -import ( - _ "os" ) - -// badBar is a function. -func badBar() string { x := true - if x { - // This is the only foldable thing in this file when lineFoldingOnly - fmt.Println("true") - } else { - fmt.Println("false") } - return -} diff --git a/internal/lsp/testdata/foo/foo.go b/internal/lsp/testdata/foo/foo.go deleted file mode 100644 index 20ea183e5..000000000 --- a/internal/lsp/testdata/foo/foo.go +++ /dev/null @@ -1,30 +0,0 @@ -package foo //@mark(PackageFoo, "foo"),item(PackageFoo, "foo", "\"golang.org/x/tools/internal/lsp/foo\"", "package") - -type StructFoo struct { //@item(StructFoo, "StructFoo", "struct{...}", "struct") - Value int //@item(Value, "Value", "int", "field") -} - -// Pre-set this marker, as we don't have a "source" for it in this package. -/* Error() */ //@item(Error, "Error", "func() string", "method") - -func Foo() { //@item(Foo, "Foo", "func()", "func") - var err error - err.Error() //@complete("E", Error) -} - -func _() { - var sFoo StructFoo //@mark(sFoo1, "sFoo"),complete("t", StructFoo) - if x := sFoo; x.Value == 1 { //@mark(sFoo2, "sFoo"),complete("V", Value),typdef("sFoo", StructFoo),refs("sFo", sFoo1, sFoo2) - return - } -} - -func _() { - shadowed := 123 - { - shadowed := "hi" //@item(shadowed, "shadowed", "string", "var"),refs("shadowed", shadowed) - sha //@complete("a", shadowed) - } -} - -type IntFoo int //@item(IntFoo, "IntFoo", "int", "type") diff --git a/internal/lsp/testdata/format/bad_format.go.golden b/internal/lsp/testdata/format/bad_format.go.golden deleted file mode 100644 index c2ac5a1a1..000000000 --- a/internal/lsp/testdata/format/bad_format.go.golden +++ /dev/null @@ -1,21 +0,0 @@ --- gofmt -- -package format //@format("package") - -import ( - "fmt" - "log" - "runtime" -) - -func hello() { - - var x int //@diag("x", "compiler", "x declared but not used", "error") -} - -func hi() { - runtime.GOROOT() - fmt.Printf("") - - log.Printf("") -} - diff --git a/internal/lsp/testdata/format/bad_format.go.in b/internal/lsp/testdata/format/bad_format.go.in deleted file mode 100644 index 06187238e..000000000 --- a/internal/lsp/testdata/format/bad_format.go.in +++ /dev/null @@ -1,22 +0,0 @@ -package format //@format("package") - -import ( - "runtime" - "fmt" - "log" -) - -func hello() { - - - - - var x int //@diag("x", "compiler", "x declared but not used", "error") -} - -func hi() { - runtime.GOROOT() - fmt.Printf("") - - log.Printf("") -} diff --git a/internal/lsp/testdata/format/good_format.go b/internal/lsp/testdata/format/good_format.go deleted file mode 100644 index 01cb1610c..000000000 --- a/internal/lsp/testdata/format/good_format.go +++ /dev/null @@ -1,9 +0,0 @@ -package format //@format("package") - -import ( - "log" -) - -func goodbye() { - log.Printf("byeeeee") -} diff --git a/internal/lsp/testdata/format/good_format.go.golden b/internal/lsp/testdata/format/good_format.go.golden deleted file mode 100644 index 99f47e2e8..000000000 --- a/internal/lsp/testdata/format/good_format.go.golden +++ /dev/null @@ -1,11 +0,0 @@ --- gofmt -- -package format //@format("package") - -import ( - "log" -) - -func goodbye() { - log.Printf("byeeeee") -} - diff --git a/internal/lsp/testdata/format/newline_format.go.golden b/internal/lsp/testdata/format/newline_format.go.golden deleted file mode 100644 index 7c76afdd5..000000000 --- a/internal/lsp/testdata/format/newline_format.go.golden +++ /dev/null @@ -1,4 +0,0 @@ --- gofmt -- -package format //@format("package") -func _() {} - diff --git a/internal/lsp/testdata/format/newline_format.go.in b/internal/lsp/testdata/format/newline_format.go.in deleted file mode 100644 index fe597b90b..000000000 --- a/internal/lsp/testdata/format/newline_format.go.in +++ /dev/null @@ -1,2 +0,0 @@ -package format //@format("package") -func _() {}
\ No newline at end of file diff --git a/internal/lsp/testdata/format/one_line.go.golden b/internal/lsp/testdata/format/one_line.go.golden deleted file mode 100644 index 4d11f84cb..000000000 --- a/internal/lsp/testdata/format/one_line.go.golden +++ /dev/null @@ -1,3 +0,0 @@ --- gofmt -- -package format //@format("package") - diff --git a/internal/lsp/testdata/format/one_line.go.in b/internal/lsp/testdata/format/one_line.go.in deleted file mode 100644 index 30f413755..000000000 --- a/internal/lsp/testdata/format/one_line.go.in +++ /dev/null @@ -1 +0,0 @@ -package format //@format("package")
\ No newline at end of file diff --git a/internal/lsp/testdata/func_rank/func_rank.go.in b/internal/lsp/testdata/func_rank/func_rank.go.in deleted file mode 100644 index 905010b3d..000000000 --- a/internal/lsp/testdata/func_rank/func_rank.go.in +++ /dev/null @@ -1,70 +0,0 @@ -package func_rank - -import "net/http" - -var stringAVar = "var" //@item(stringAVar, "stringAVar", "string", "var") -func stringBFunc() string { return "str" } //@item(stringBFunc, "stringBFunc", "func() string", "func") -type stringer struct{} //@item(stringer, "stringer", "struct{...}", "struct") - -func _() stringer //@complete("tr", stringer) - -func _(val stringer) {} //@complete("tr", stringer) - -func (stringer) _() {} //@complete("tr", stringer) - -func _() { - var s struct { - AA int //@item(rankAA, "AA", "int", "field") - AB string //@item(rankAB, "AB", "string", "field") - AC int //@item(rankAC, "AC", "int", "field") - } - fnStr := func(string) {} - fnStr(s.A) //@complete(")", rankAB, rankAA, rankAC) - fnStr("" + s.A) //@complete(")", rankAB, rankAA, rankAC) - - fnInt := func(int) {} - fnInt(-s.A) //@complete(")", rankAA, rankAC, rankAB) - - // no expected type - fnInt(func() int { s.A }) //@complete(" }", rankAA, rankAB, rankAC) - fnInt(s.A()) //@complete("()", rankAA, rankAC, rankAB) - fnInt([]int{}[s.A]) //@complete("])", rankAA, rankAC, rankAB) - fnInt([]int{}[:s.A]) //@complete("])", rankAA, rankAC, rankAB) - - fnInt(s.A.(int)) //@complete(".(", rankAA, rankAC, rankAB) - - fnPtr := func(*string) {} - fnPtr(&s.A) //@complete(")", rankAB, rankAA, rankAC) - - var aaPtr *string //@item(rankAAPtr, "aaPtr", "*string", "var") - var abPtr *int //@item(rankABPtr, "abPtr", "*int", "var") - fnInt(*a) //@complete(")", rankABPtr, rankAAPtr) - - _ = func() string { - return s.A //@complete(" //", rankAB, rankAA, rankAC) - } -} - -type foo struct { - fooPrivateField int //@item(rankFooPrivField, "fooPrivateField", "int", "field") - FooPublicField int //@item(rankFooPubField, "FooPublicField", "int", "field") -} - -func (foo) fooPrivateMethod() int { //@item(rankFooPrivMeth, "fooPrivateMethod", "func() int", "method") - return 0 -} - -func (foo) FooPublicMethod() int { //@item(rankFooPubMeth, "FooPublicMethod", "func() int", "method") - return 0 -} - -func _() { - var _ int = foo{}. //@rank(" //", rankFooPrivField, rankFooPubField),rank(" //", rankFooPrivMeth, rankFooPubMeth),rank(" //", rankFooPrivField, rankFooPrivMeth) -} - -func _() { - HandleFunc //@item(httpHandleFunc, "HandleFunc", "func(pattern string, handler func(http.ResponseWriter, *http.Request))", "func") - HandlerFunc //@item(httpHandlerFunc, "HandlerFunc", "func(http.ResponseWriter, *http.Request)", "type") - - http.HandleFunc //@rank(" //", httpHandleFunc, httpHandlerFunc) -} diff --git a/internal/lsp/testdata/funcsig/func_sig.go b/internal/lsp/testdata/funcsig/func_sig.go deleted file mode 100644 index 00f9b575d..000000000 --- a/internal/lsp/testdata/funcsig/func_sig.go +++ /dev/null @@ -1,9 +0,0 @@ -package funcsig - -type someType int //@item(sigSomeType, "someType", "int", "type") - -// Don't complete "foo" in signature. -func (foo someType) _() { //@item(sigFoo, "foo", "someType", "var"),complete(") {", sigSomeType) - - //@complete("", sigFoo, sigSomeType) -} diff --git a/internal/lsp/testdata/funcvalue/func_value.go b/internal/lsp/testdata/funcvalue/func_value.go deleted file mode 100644 index 913fcbcfe..000000000 --- a/internal/lsp/testdata/funcvalue/func_value.go +++ /dev/null @@ -1,27 +0,0 @@ -package funcvalue - -func fooFunc() int { //@item(fvFooFunc, "fooFunc", "func() int", "func") - return 0 -} - -var _ = fooFunc() //@item(fvFooFuncCall, "fooFunc", "func() int", "func") - -var fooVar = func() int { //@item(fvFooVar, "fooVar", "func() int", "var") - return 0 -} - -var _ = fooVar() //@item(fvFooVarCall, "fooVar", "func() int", "var") - -type myFunc func() int - -var fooType myFunc = fooVar //@item(fvFooType, "fooType", "myFunc", "var") - -var _ = fooType() //@item(fvFooTypeCall, "fooType", "func() int", "var") - -func _() { - var f func() int - f = foo //@complete(" //", fvFooFunc, fvFooType, fvFooVar) - - var i int - i = foo //@complete(" //", fvFooFuncCall, fvFooTypeCall, fvFooVarCall) -} diff --git a/internal/lsp/testdata/fuzzymatch/fuzzymatch.go b/internal/lsp/testdata/fuzzymatch/fuzzymatch.go deleted file mode 100644 index 73268f553..000000000 --- a/internal/lsp/testdata/fuzzymatch/fuzzymatch.go +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2019 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package fuzzy - -func _() { - var a struct { - fabar int - fooBar string - } - - a.fabar //@item(fuzzFabarField, "a.fabar", "int", "field") - a.fooBar //@item(fuzzFooBarField, "a.fooBar", "string", "field") - - afa //@fuzzy(" //", fuzzFabarField, fuzzFooBarField) - afb //@fuzzy(" //", fuzzFooBarField, fuzzFabarField) - - fab //@fuzzy(" //", fuzzFabarField) - - var myString string - myString = af //@fuzzy(" //", fuzzFooBarField, fuzzFabarField) - - var b struct { - c struct { - d struct { - e struct { - abc string - } - abc float32 - } - abc bool - } - abc int - } - - b.abc //@item(fuzzABCInt, "b.abc", "int", "field") - b.c.abc //@item(fuzzABCbool, "b.c.abc", "bool", "field") - b.c.d.abc //@item(fuzzABCfloat, "b.c.d.abc", "float32", "field") - b.c.d.e.abc //@item(fuzzABCstring, "b.c.d.e.abc", "string", "field") - - // in depth order by default - abc //@fuzzy(" //", fuzzABCInt, fuzzABCbool, fuzzABCfloat) - - // deep candidate that matches expected type should still ranked first - var s string - s = abc //@fuzzy(" //", fuzzABCstring, fuzzABCInt, fuzzABCbool) -} diff --git a/internal/lsp/testdata/generate/generate.go b/internal/lsp/testdata/generate/generate.go deleted file mode 100644 index ae5e90d1a..000000000 --- a/internal/lsp/testdata/generate/generate.go +++ /dev/null @@ -1,4 +0,0 @@ -package generate - -//go:generate echo Hi //@ codelens("//go:generate", "run go generate", "generate"), codelens("//go:generate", "run go generate ./...", "generate") -//go:generate echo I shall have no CodeLens diff --git a/internal/lsp/testdata/generated/generated.go b/internal/lsp/testdata/generated/generated.go deleted file mode 100644 index c92bd9eb8..000000000 --- a/internal/lsp/testdata/generated/generated.go +++ /dev/null @@ -1,7 +0,0 @@ -package generated - -// Code generated by generator.go. DO NOT EDIT. - -func _() { - var y int //@diag("y", "compiler", "y declared but not used", "error") -} diff --git a/internal/lsp/testdata/generated/generator.go b/internal/lsp/testdata/generated/generator.go deleted file mode 100644 index f26e33c80..000000000 --- a/internal/lsp/testdata/generated/generator.go +++ /dev/null @@ -1,5 +0,0 @@ -package generated - -func _() { - var x int //@diag("x", "compiler", "x declared but not used", "error") -} diff --git a/internal/lsp/testdata/godef/a/a.go b/internal/lsp/testdata/godef/a/a.go deleted file mode 100644 index 5cc85527a..000000000 --- a/internal/lsp/testdata/godef/a/a.go +++ /dev/null @@ -1,105 +0,0 @@ -// Package a is a package for testing go to definition. -package a //@mark(aPackage, "a "),hoverdef("a ", aPackage) - -import ( - "fmt" - "go/types" - "sync" -) - -var ( - // x is a variable. - x string //@x,hoverdef("x", x) -) - -// Constant block. When I hover on h, I should see this comment. -const ( - // When I hover on g, I should see this comment. - g = 1 //@g,hoverdef("g", g) - - h = 2 //@h,hoverdef("h", h) -) - -// z is a variable too. -var z string //@z,hoverdef("z", z) - -type A string //@mark(AString, "A") - -func AStuff() { //@AStuff - x := 5 - Random2(x) //@godef("dom2", Random2) - Random() //@godef("()", Random) - - var err error //@err - fmt.Printf("%v", err) //@godef("err", err) - - var y string //@string,hoverdef("string", string) - _ = make([]int, 0) //@make,hoverdef("make", make) - - var mu sync.Mutex - mu.Lock() //@Lock,hoverdef("Lock", Lock) - - var typ *types.Named //@mark(typesImport, "types"),hoverdef("types", typesImport) - typ.Obj().Name() //@Name,hoverdef("Name", Name) -} - -type A struct { -} - -func (_ A) Hi() {} //@mark(AHi, "Hi") - -type S struct { - Field int //@mark(AField, "Field") - R // embed a struct - H // embed an interface -} - -type R struct { - Field2 int //@mark(AField2, "Field2") -} - -func (_ R) Hey() {} //@mark(AHey, "Hey") - -type H interface { - Goodbye() //@mark(AGoodbye, "Goodbye") -} - -type I interface { - B() //@mark(AB, "B") - J -} - -type J interface { - Hello() //@mark(AHello, "Hello") -} - -func _() { - // 1st type declaration block - type ( - a struct { //@mark(declBlockA, "a"),hoverdef("a", declBlockA) - x string - } - ) - - // 2nd type declaration block - type ( - // b has a comment - b struct{} //@mark(declBlockB, "b"),hoverdef("b", declBlockB) - ) - - // 3rd type declaration block - type ( - // c is a struct - c struct { //@mark(declBlockC, "c"),hoverdef("c", declBlockC) - f string - } - - d string //@mark(declBlockD, "d"),hoverdef("d", declBlockD) - ) - - type ( - e struct { //@mark(declBlockE, "e"),hoverdef("e", declBlockE) - f float64 - } // e has a comment - ) -} diff --git a/internal/lsp/testdata/godef/a/a.go.golden b/internal/lsp/testdata/godef/a/a.go.golden deleted file mode 100644 index 9f67a147d..000000000 --- a/internal/lsp/testdata/godef/a/a.go.golden +++ /dev/null @@ -1,190 +0,0 @@ --- Lock-hoverdef -- -```go -func (*sync.Mutex).Lock() -``` - -Lock locks m\. - -[`(sync.Mutex).Lock` on pkg.go.dev](https://pkg.go.dev/sync?utm_source=gopls#Mutex.Lock) --- Name-hoverdef -- -```go -func (*types.object).Name() string -``` - -Name returns the object\'s \(package\-local, unqualified\) name\. - -[`(types.TypeName).Name` on pkg.go.dev](https://pkg.go.dev/go/types?utm_source=gopls#TypeName.Name) --- Random-definition -- -godef/a/random.go:3:6-12: defined here as ```go -func Random() int -``` - -[`a.Random` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Random) --- Random-definition-json -- -{ - "span": { - "uri": "file://godef/a/random.go", - "start": { - "line": 3, - "column": 6, - "offset": 16 - }, - "end": { - "line": 3, - "column": 12, - "offset": 22 - } - }, - "description": "```go\nfunc Random() int\n```\n\n[`a.Random` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Random)" -} - --- Random-hoverdef -- -```go -func Random() int -``` - -[`a.Random` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Random) --- Random2-definition -- -godef/a/random.go:8:6-13: defined here as ```go -func Random2(y int) int -``` - -[`a.Random2` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Random2) --- Random2-definition-json -- -{ - "span": { - "uri": "file://godef/a/random.go", - "start": { - "line": 8, - "column": 6, - "offset": 71 - }, - "end": { - "line": 8, - "column": 13, - "offset": 78 - } - }, - "description": "```go\nfunc Random2(y int) int\n```\n\n[`a.Random2` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Random2)" -} - --- Random2-hoverdef -- -```go -func Random2(y int) int -``` - -[`a.Random2` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Random2) --- aPackage-hoverdef -- -Package a is a package for testing go to definition\. --- declBlockA-hoverdef -- -```go -type a struct { - x string -} -``` - -1st type declaration block --- declBlockB-hoverdef -- -```go -type b struct{} -``` - -b has a comment --- declBlockC-hoverdef -- -```go -type c struct { - f string -} -``` - -c is a struct --- declBlockD-hoverdef -- -```go -type d string -``` - -3rd type declaration block --- declBlockE-hoverdef -- -```go -type e struct { - f float64 -} -``` - -e has a comment --- err-definition -- -godef/a/a.go:33:6-9: defined here as ```go -var err error -``` - -\@err --- err-definition-json -- -{ - "span": { - "uri": "file://godef/a/a.go", - "start": { - "line": 33, - "column": 6, - "offset": 612 - }, - "end": { - "line": 33, - "column": 9, - "offset": 615 - } - }, - "description": "```go\nvar err error\n```\n\n\\@err" -} - --- err-hoverdef -- -```go -var err error -``` - -\@err --- g-hoverdef -- -```go -const g untyped int = 1 -``` - -When I hover on g, I should see this comment\. --- h-hoverdef -- -```go -const h untyped int = 2 -``` - -Constant block\. --- make-hoverdef -- -```go -func make(t Type, size ...int) Type -``` - -The make built\-in function allocates and initializes an object of type slice, map, or chan \(only\)\. - -[`make` on pkg.go.dev](https://pkg.go.dev/builtin?utm_source=gopls#make) --- string-hoverdef -- -```go -type string string -``` - -string is the set of all strings of 8\-bit bytes, conventionally but not necessarily representing UTF\-8\-encoded text\. - -[`string` on pkg.go.dev](https://pkg.go.dev/builtin?utm_source=gopls#string) --- typesImport-hoverdef -- -```go -package types ("go/types") -``` - -[`types` on pkg.go.dev](https://pkg.go.dev/go/types?utm_source=gopls) --- x-hoverdef -- -```go -var x string -``` - -x is a variable\. --- z-hoverdef -- -```go -var z string -``` - -z is a variable too\. diff --git a/internal/lsp/testdata/godef/a/a_test.go b/internal/lsp/testdata/godef/a/a_test.go deleted file mode 100644 index 77bd633b6..000000000 --- a/internal/lsp/testdata/godef/a/a_test.go +++ /dev/null @@ -1,8 +0,0 @@ -package a - -import ( - "testing" -) - -func TestA(t *testing.T) { //@TestA,godef(TestA, TestA) -} diff --git a/internal/lsp/testdata/godef/a/a_test.go.golden b/internal/lsp/testdata/godef/a/a_test.go.golden deleted file mode 100644 index e5cb3d799..000000000 --- a/internal/lsp/testdata/godef/a/a_test.go.golden +++ /dev/null @@ -1,26 +0,0 @@ --- TestA-definition -- -godef/a/a_test.go:7:6-11: defined here as ```go -func TestA(t *testing.T) -``` --- TestA-definition-json -- -{ - "span": { - "uri": "file://godef/a/a_test.go", - "start": { - "line": 7, - "column": 6, - "offset": 39 - }, - "end": { - "line": 7, - "column": 11, - "offset": 44 - } - }, - "description": "```go\nfunc TestA(t *testing.T)\n```" -} - --- TestA-hoverdef -- -```go -func TestA(t *testing.T) -``` diff --git a/internal/lsp/testdata/godef/a/a_x_test.go b/internal/lsp/testdata/godef/a/a_x_test.go deleted file mode 100644 index 4631eba2c..000000000 --- a/internal/lsp/testdata/godef/a/a_x_test.go +++ /dev/null @@ -1,9 +0,0 @@ -package a_test - -import ( - "testing" -) - -func TestA2(t *testing.T) { //@TestA2,godef(TestA2, TestA2) - Nonexistant() //@diag("Nonexistant", "compiler", "undeclared name: Nonexistant", "error") -} diff --git a/internal/lsp/testdata/godef/a/a_x_test.go.golden b/internal/lsp/testdata/godef/a/a_x_test.go.golden deleted file mode 100644 index 2e3064794..000000000 --- a/internal/lsp/testdata/godef/a/a_x_test.go.golden +++ /dev/null @@ -1,26 +0,0 @@ --- TestA2-definition -- -godef/a/a_x_test.go:7:6-12: defined here as ```go -func TestA2(t *testing.T) -``` --- TestA2-definition-json -- -{ - "span": { - "uri": "file://godef/a/a_x_test.go", - "start": { - "line": 7, - "column": 6, - "offset": 44 - }, - "end": { - "line": 7, - "column": 12, - "offset": 50 - } - }, - "description": "```go\nfunc TestA2(t *testing.T)\n```" -} - --- TestA2-hoverdef -- -```go -func TestA2(t *testing.T) -``` diff --git a/internal/lsp/testdata/godef/a/d.go b/internal/lsp/testdata/godef/a/d.go deleted file mode 100644 index 2da8d058e..000000000 --- a/internal/lsp/testdata/godef/a/d.go +++ /dev/null @@ -1,43 +0,0 @@ -package a //@mark(a, "a "),hoverdef("a ", a) - -import "fmt" - -type Thing struct { //@Thing - Member string //@Member -} - -var Other Thing //@Other - -func Things(val []string) []Thing { //@Things - return nil -} - -func (t Thing) Method(i int) string { //@Method - return t.Member -} - -func useThings() { - t := Thing{ //@mark(aStructType, "ing") - Member: "string", //@mark(fMember, "ember") - } - fmt.Print(t.Member) //@mark(aMember, "ember") - fmt.Print(Other) //@mark(aVar, "ther") - Things() //@mark(aFunc, "ings") - t.Method() //@mark(aMethod, "eth") -} - -/*@ -godef(aStructType, Thing) -godef(aMember, Member) -godef(aVar, Other) -godef(aFunc, Things) -godef(aMethod, Method) -godef(fMember, Member) -godef(Member, Member) - -//param -//package name -//const -//anon field - -*/ diff --git a/internal/lsp/testdata/godef/a/d.go.golden b/internal/lsp/testdata/godef/a/d.go.golden deleted file mode 100644 index 47723b045..000000000 --- a/internal/lsp/testdata/godef/a/d.go.golden +++ /dev/null @@ -1,164 +0,0 @@ --- Member-definition -- -godef/a/d.go:6:2-8: defined here as ```go -field Member string -``` - -\@Member - -[`(a.Thing).Member` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Thing.Member) --- Member-definition-json -- -{ - "span": { - "uri": "file://godef/a/d.go", - "start": { - "line": 6, - "column": 2, - "offset": 90 - }, - "end": { - "line": 6, - "column": 8, - "offset": 96 - } - }, - "description": "```go\nfield Member string\n```\n\n\\@Member\n\n[`(a.Thing).Member` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Thing.Member)" -} - --- Member-hoverdef -- -```go -field Member string -``` - -\@Member - -[`(a.Thing).Member` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Thing.Member) --- Method-definition -- -godef/a/d.go:15:16-22: defined here as ```go -func (Thing).Method(i int) string -``` - -[`(a.Thing).Method` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Thing.Method) --- Method-definition-json -- -{ - "span": { - "uri": "file://godef/a/d.go", - "start": { - "line": 15, - "column": 16, - "offset": 219 - }, - "end": { - "line": 15, - "column": 22, - "offset": 225 - } - }, - "description": "```go\nfunc (Thing).Method(i int) string\n```\n\n[`(a.Thing).Method` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Thing.Method)" -} - --- Method-hoverdef -- -```go -func (Thing).Method(i int) string -``` - -[`(a.Thing).Method` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Thing.Method) --- Other-definition -- -godef/a/d.go:9:5-10: defined here as ```go -var Other Thing -``` - -\@Other - -[`a.Other` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Other) --- Other-definition-json -- -{ - "span": { - "uri": "file://godef/a/d.go", - "start": { - "line": 9, - "column": 5, - "offset": 121 - }, - "end": { - "line": 9, - "column": 10, - "offset": 126 - } - }, - "description": "```go\nvar Other Thing\n```\n\n\\@Other\n\n[`a.Other` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Other)" -} - --- Other-hoverdef -- -```go -var Other Thing -``` - -\@Other - -[`a.Other` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Other) --- Thing-definition -- -godef/a/d.go:5:6-11: defined here as ```go -type Thing struct { - Member string //@Member -} -``` - -[`a.Thing` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Thing) --- Thing-definition-json -- -{ - "span": { - "uri": "file://godef/a/d.go", - "start": { - "line": 5, - "column": 6, - "offset": 65 - }, - "end": { - "line": 5, - "column": 11, - "offset": 70 - } - }, - "description": "```go\ntype Thing struct {\n\tMember string //@Member\n}\n```\n\n[`a.Thing` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Thing)" -} - --- Thing-hoverdef -- -```go -type Thing struct { - Member string //@Member -} -``` - -[`a.Thing` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Thing) --- Things-definition -- -godef/a/d.go:11:6-12: defined here as ```go -func Things(val []string) []Thing -``` - -[`a.Things` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Things) --- Things-definition-json -- -{ - "span": { - "uri": "file://godef/a/d.go", - "start": { - "line": 11, - "column": 6, - "offset": 148 - }, - "end": { - "line": 11, - "column": 12, - "offset": 154 - } - }, - "description": "```go\nfunc Things(val []string) []Thing\n```\n\n[`a.Things` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Things)" -} - --- Things-hoverdef -- -```go -func Things(val []string) []Thing -``` - -[`a.Things` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Things) --- a-hoverdef -- -Package a is a package for testing go to definition\. diff --git a/internal/lsp/testdata/godef/a/f.go b/internal/lsp/testdata/godef/a/f.go deleted file mode 100644 index 589c45fc1..000000000 --- a/internal/lsp/testdata/godef/a/f.go +++ /dev/null @@ -1,15 +0,0 @@ -package a - -import "fmt" - -func TypeStuff() { //@Stuff - var x string - - switch y := interface{}(x).(type) { //@mark(switchY, "y"),godef("y", switchY) - case int: //@mark(intY, "int") - fmt.Printf("%v", y) //@hoverdef("y", intY) - case string: //@mark(stringY, "string") - fmt.Printf("%v", y) //@hoverdef("y", stringY) - } - -} diff --git a/internal/lsp/testdata/godef/a/f.go.golden b/internal/lsp/testdata/godef/a/f.go.golden deleted file mode 100644 index a084356c0..000000000 --- a/internal/lsp/testdata/godef/a/f.go.golden +++ /dev/null @@ -1,34 +0,0 @@ --- intY-hoverdef -- -```go -var y int -``` --- stringY-hoverdef -- -```go -var y string -``` --- switchY-definition -- -godef/a/f.go:8:9-10: defined here as ```go -var y interface{} -``` --- switchY-definition-json -- -{ - "span": { - "uri": "file://godef/a/f.go", - "start": { - "line": 8, - "column": 9, - "offset": 76 - }, - "end": { - "line": 8, - "column": 10, - "offset": 77 - } - }, - "description": "```go\nvar y interface{}\n```" -} - --- switchY-hoverdef -- -```go -var y interface{} -``` diff --git a/internal/lsp/testdata/godef/a/g.go b/internal/lsp/testdata/godef/a/g.go deleted file mode 100644 index dfef2fb80..000000000 --- a/internal/lsp/testdata/godef/a/g.go +++ /dev/null @@ -1,6 +0,0 @@ -package a - -import "time" - -// dur is a constant of type time.Duration. -const dur = 15*time.Minute + 10*time.Second + 350*time.Millisecond //@dur,hoverdef("dur", dur) diff --git a/internal/lsp/testdata/godef/a/g.go.golden b/internal/lsp/testdata/godef/a/g.go.golden deleted file mode 100644 index b7ed73928..000000000 --- a/internal/lsp/testdata/godef/a/g.go.golden +++ /dev/null @@ -1,6 +0,0 @@ --- dur-hoverdef -- -```go -const dur time.Duration = 910350000000 // 15m10.35s -``` - -dur is a constant of type time\.Duration\. diff --git a/internal/lsp/testdata/godef/a/h.go b/internal/lsp/testdata/godef/a/h.go deleted file mode 100644 index 5a5dcc678..000000000 --- a/internal/lsp/testdata/godef/a/h.go +++ /dev/null @@ -1,147 +0,0 @@ -package a - -func _() { - type s struct { - nested struct { - // nested number - number int64 //@mark(nestedNumber, "number") - } - nested2 []struct { - // nested string - str string //@mark(nestedString, "str") - } - x struct { - x struct { - x struct { - x struct { - x struct { - // nested map - m map[string]float64 //@mark(nestedMap, "m") - } - } - } - } - } - } - - var t s - _ = t.nested.number //@hoverdef("number", nestedNumber) - _ = t.nested2[0].str //@hoverdef("str", nestedString) - _ = t.x.x.x.x.x.m //@hoverdef("m", nestedMap) -} - -func _() { - var s struct { - // a field - a int //@mark(structA, "a") - // b nested struct - b struct { //@mark(structB, "b") - // c field of nested struct - c int //@mark(structC, "c") - } - } - _ = s.a //@hoverdef("a", structA) - _ = s.b //@hoverdef("b", structB) - _ = s.b.c //@hoverdef("c", structC) - - var arr []struct { - // d field - d int //@mark(arrD, "d") - // e nested struct - e struct { //@mark(arrE, "e") - // f field of nested struct - f int //@mark(arrF, "f") - } - } - _ = arr[0].d //@hoverdef("d", arrD) - _ = arr[0].e //@hoverdef("e", arrE) - _ = arr[0].e.f //@hoverdef("f", arrF) - - var complex []struct { - c <-chan map[string][]struct { - // h field - h int //@mark(complexH, "h") - // i nested struct - i struct { //@mark(complexI, "i") - // j field of nested struct - j int //@mark(complexJ, "j") - } - } - } - _ = (<-complex[0].c)["0"][0].h //@hoverdef("h", complexH) - _ = (<-complex[0].c)["0"][0].i //@hoverdef("i", complexI) - _ = (<-complex[0].c)["0"][0].i.j //@hoverdef("j", complexJ) - - var mapWithStructKey map[struct { - // X key field - x []string //@mark(mapStructKeyX, "x") - }]int - for k := range mapWithStructKey { - _ = k.x //@hoverdef("x", mapStructKeyX) - } - - var mapWithStructKeyAndValue map[struct { - // Y key field - y string //@mark(mapStructKeyY, "y") - }]struct { - // X value field - x string //@mark(mapStructValueX, "x") - } - for k, v := range mapWithStructKeyAndValue { - // TODO: we don't show docs for y field because both map key and value - // are structs. And in this case, we parse only map value - _ = k.y //@hoverdef("y", mapStructKeyY) - _ = v.x //@hoverdef("x", mapStructValueX) - } - - var i []map[string]interface { - // open method comment - open() error //@mark(openMethod, "open") - } - i[0]["1"].open() //@hoverdef("open", openMethod) -} - -func _() { - test := struct { - // test description - desc string //@mark(testDescription, "desc") - }{} - _ = test.desc //@hoverdef("desc", testDescription) - - for _, tt := range []struct { - // test input - in map[string][]struct { //@mark(testInput, "in") - // test key - key string //@mark(testInputKey, "key") - // test value - value interface{} //@mark(testInputValue, "value") - } - result struct { - v <-chan struct { - // expected test value - value int //@mark(testResultValue, "value") - } - } - }{} { - _ = tt.in //@hoverdef("in", testInput) - _ = tt.in["0"][0].key //@hoverdef("key", testInputKey) - _ = tt.in["0"][0].value //@hoverdef("value", testInputValue) - - _ = (<-tt.result.v).value //@hoverdef("value", testResultValue) - } -} - -func _() { - getPoints := func() []struct { - // X coord - x int //@mark(returnX, "x") - // Y coord - y int //@mark(returnY, "y") - } { - return nil - } - - r := getPoints() - r[0].x //@hoverdef("x", returnX) - r[0].y //@hoverdef("y", returnY) -} diff --git a/internal/lsp/testdata/godef/a/h.go.golden b/internal/lsp/testdata/godef/a/h.go.golden deleted file mode 100644 index 4b27211e9..000000000 --- a/internal/lsp/testdata/godef/a/h.go.golden +++ /dev/null @@ -1,136 +0,0 @@ --- arrD-hoverdef -- -```go -field d int -``` - -d field --- arrE-hoverdef -- -```go -field e struct{f int} -``` - -e nested struct --- arrF-hoverdef -- -```go -field f int -``` - -f field of nested struct --- complexH-hoverdef -- -```go -field h int -``` - -h field --- complexI-hoverdef -- -```go -field i struct{j int} -``` - -i nested struct --- complexJ-hoverdef -- -```go -field j int -``` - -j field of nested struct --- mapStructKeyX-hoverdef -- -```go -field x []string -``` - -X key field --- mapStructKeyY-hoverdef -- -```go -field y string -``` --- mapStructValueX-hoverdef -- -```go -field x string -``` - -X value field --- nestedMap-hoverdef -- -```go -field m map[string]float64 -``` - -nested map --- nestedNumber-hoverdef -- -```go -field number int64 -``` - -nested number --- nestedString-hoverdef -- -```go -field str string -``` - -nested string --- openMethod-hoverdef -- -```go -func (interface).open() error -``` - -open method comment --- returnX-hoverdef -- -```go -field x int -``` - -X coord --- returnY-hoverdef -- -```go -field y int -``` - -Y coord --- structA-hoverdef -- -```go -field a int -``` - -a field --- structB-hoverdef -- -```go -field b struct{c int} -``` - -b nested struct --- structC-hoverdef -- -```go -field c int -``` - -c field of nested struct --- testDescription-hoverdef -- -```go -field desc string -``` - -test description --- testInput-hoverdef -- -```go -field in map[string][]struct{key string; value interface{}} -``` - -test input --- testInputKey-hoverdef -- -```go -field key string -``` - -test key --- testInputValue-hoverdef -- -```go -field value interface{} -``` - -test value --- testResultValue-hoverdef -- -```go -field value int -``` - -expected test value diff --git a/internal/lsp/testdata/godef/a/random.go b/internal/lsp/testdata/godef/a/random.go deleted file mode 100644 index 62055c1fc..000000000 --- a/internal/lsp/testdata/godef/a/random.go +++ /dev/null @@ -1,31 +0,0 @@ -package a - -func Random() int { //@Random - y := 6 + 7 - return y -} - -func Random2(y int) int { //@Random2,mark(RandomParamY, "y") - return y //@godef("y", RandomParamY) -} - -type Pos struct { - x, y int //@mark(PosX, "x"),mark(PosY, "y") -} - -// Typ has a comment. Its fields do not. -type Typ struct{ field string } //@mark(TypField, "field") - -func _() { - x := &Typ{} - x.field //@godef("field", TypField) -} - -func (p *Pos) Sum() int { //@mark(PosSum, "Sum") - return p.x + p.y //@godef("x", PosX) -} - -func _() { - var p Pos - _ = p.Sum() //@godef("()", PosSum) -} diff --git a/internal/lsp/testdata/godef/a/random.go.golden b/internal/lsp/testdata/godef/a/random.go.golden deleted file mode 100644 index 381a11ace..000000000 --- a/internal/lsp/testdata/godef/a/random.go.golden +++ /dev/null @@ -1,112 +0,0 @@ --- PosSum-definition -- -godef/a/random.go:24:15-18: defined here as ```go -func (*Pos).Sum() int -``` - -[`(a.Pos).Sum` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Pos.Sum) --- PosSum-definition-json -- -{ - "span": { - "uri": "file://godef/a/random.go", - "start": { - "line": 24, - "column": 15, - "offset": 413 - }, - "end": { - "line": 24, - "column": 18, - "offset": 416 - } - }, - "description": "```go\nfunc (*Pos).Sum() int\n```\n\n[`(a.Pos).Sum` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Pos.Sum)" -} - --- PosSum-hoverdef -- -```go -func (*Pos).Sum() int -``` - -[`(a.Pos).Sum` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Pos.Sum) --- PosX-definition -- -godef/a/random.go:13:2-3: defined here as ```go -field x int -``` - -\@mark\(PosX, \"x\"\),mark\(PosY, \"y\"\) --- PosX-definition-json -- -{ - "span": { - "uri": "file://godef/a/random.go", - "start": { - "line": 13, - "column": 2, - "offset": 187 - }, - "end": { - "line": 13, - "column": 3, - "offset": 188 - } - }, - "description": "```go\nfield x int\n```\n\n\\@mark\\(PosX, \\\"x\\\"\\),mark\\(PosY, \\\"y\\\"\\)" -} - --- PosX-hoverdef -- -```go -field x int -``` - -\@mark\(PosX, \"x\"\),mark\(PosY, \"y\"\) --- RandomParamY-definition -- -godef/a/random.go:8:14-15: defined here as ```go -var y int -``` --- RandomParamY-definition-json -- -{ - "span": { - "uri": "file://godef/a/random.go", - "start": { - "line": 8, - "column": 14, - "offset": 79 - }, - "end": { - "line": 8, - "column": 15, - "offset": 80 - } - }, - "description": "```go\nvar y int\n```" -} - --- RandomParamY-hoverdef -- -```go -var y int -``` --- TypField-definition -- -godef/a/random.go:17:18-23: defined here as ```go -field field string -``` --- TypField-definition-json -- -{ - "span": { - "uri": "file://godef/a/random.go", - "start": { - "line": 17, - "column": 18, - "offset": 292 - }, - "end": { - "line": 17, - "column": 23, - "offset": 297 - } - }, - "description": "```go\nfield field string\n```" -} - --- TypField-hoverdef -- -```go -field field string -``` diff --git a/internal/lsp/testdata/godef/b/b.go b/internal/lsp/testdata/godef/b/b.go deleted file mode 100644 index f9c1d6402..000000000 --- a/internal/lsp/testdata/godef/b/b.go +++ /dev/null @@ -1,57 +0,0 @@ -package b - -import ( - myFoo "golang.org/x/tools/internal/lsp/foo" //@mark(myFoo, "myFoo"),godef("myFoo", myFoo) - "golang.org/x/tools/internal/lsp/godef/a" //@mark(AImport, re"\".*\"") -) - -type Embed struct { - *a.A - a.I - a.S -} - -func _() { - e := Embed{} - e.Hi() //@hoverdef("Hi", AHi) - e.B() //@hoverdef("B", AB) - e.Field //@hoverdef("Field", AField) - e.Field2 //@hoverdef("Field2", AField2) - e.Hello() //@hoverdef("Hello", AHello) - e.Hey() //@hoverdef("Hey", AHey) - e.Goodbye() //@hoverdef("Goodbye", AGoodbye) -} - -type aAlias = a.A //@mark(aAlias, "aAlias") - -type S1 struct { //@S1 - F1 int //@mark(S1F1, "F1") - S2 //@godef("S2", S2),mark(S1S2, "S2") - a.A //@godef("A", AString) - aAlias //@godef("a", aAlias) -} - -type S2 struct { //@S2 - F1 string //@mark(S2F1, "F1") - F2 int //@mark(S2F2, "F2") - *a.A //@godef("A", AString),godef("a",AImport) -} - -type S3 struct { - F1 struct { - a.A //@godef("A", AString) - } -} - -func Bar() { - a.AStuff() //@godef("AStuff", AStuff) - var x S1 //@godef("S1", S1) - _ = x.S2 //@godef("S2", S1S2) - _ = x.F1 //@godef("F1", S1F1) - _ = x.F2 //@godef("F2", S2F2) - _ = x.S2.F1 //@godef("F1", S2F1) - - var _ *myFoo.StructFoo //@godef("myFoo", myFoo) -} - -const X = 0 //@mark(bX, "X"),godef("X", bX) diff --git a/internal/lsp/testdata/godef/b/b.go.golden b/internal/lsp/testdata/godef/b/b.go.golden deleted file mode 100644 index 5f7669b77..000000000 --- a/internal/lsp/testdata/godef/b/b.go.golden +++ /dev/null @@ -1,454 +0,0 @@ --- AB-hoverdef -- -```go -func (a.I).B() -``` - -\@mark\(AB, \"B\"\) - -[`(a.I).B` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#I.B) --- AField-hoverdef -- -```go -field Field int -``` - -\@mark\(AField, \"Field\"\) - -[`(a.S).Field` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#S.Field) --- AField2-hoverdef -- -```go -field Field2 int -``` - -\@mark\(AField2, \"Field2\"\) - -[`(a.R).Field2` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#R.Field2) --- AGoodbye-hoverdef -- -```go -func (a.H).Goodbye() -``` - -\@mark\(AGoodbye, \"Goodbye\"\) - -[`(a.H).Goodbye` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#H.Goodbye) --- AHello-hoverdef -- -```go -func (a.J).Hello() -``` - -\@mark\(AHello, \"Hello\"\) - -[`(a.J).Hello` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#J.Hello) --- AHey-hoverdef -- -```go -func (a.R).Hey() -``` - -[`(a.R).Hey` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#R.Hey) --- AHi-hoverdef -- -```go -func (a.A).Hi() -``` - -[`(a.A).Hi` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#A.Hi) --- AImport-definition -- -godef/b/b.go:5:2-43: defined here as ```go -package a ("golang.org/x/tools/internal/lsp/godef/a") -``` - -[`a` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls) --- AImport-definition-json -- -{ - "span": { - "uri": "file://godef/b/b.go", - "start": { - "line": 5, - "column": 2, - "offset": 112 - }, - "end": { - "line": 5, - "column": 43, - "offset": 153 - } - }, - "description": "```go\npackage a (\"golang.org/x/tools/internal/lsp/godef/a\")\n```\n\n[`a` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls)" -} - --- AImport-hoverdef -- -```go -package a ("golang.org/x/tools/internal/lsp/godef/a") -``` - -[`a` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls) --- AString-definition -- -godef/a/a.go:26:6-7: defined here as ```go -type A string -``` - -\@mark\(AString, \"A\"\) - -[`a.A` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#A) --- AString-definition-json -- -{ - "span": { - "uri": "file://godef/a/a.go", - "start": { - "line": 26, - "column": 6, - "offset": 467 - }, - "end": { - "line": 26, - "column": 7, - "offset": 468 - } - }, - "description": "```go\ntype A string\n```\n\n\\@mark\\(AString, \\\"A\\\"\\)\n\n[`a.A` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#A)" -} - --- AString-hoverdef -- -```go -type A string -``` - -\@mark\(AString, \"A\"\) - -[`a.A` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#A) --- AStuff-definition -- -godef/a/a.go:28:6-12: defined here as ```go -func a.AStuff() -``` - -[`a.AStuff` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#AStuff) --- AStuff-definition-json -- -{ - "span": { - "uri": "file://godef/a/a.go", - "start": { - "line": 28, - "column": 6, - "offset": 504 - }, - "end": { - "line": 28, - "column": 12, - "offset": 510 - } - }, - "description": "```go\nfunc a.AStuff()\n```\n\n[`a.AStuff` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#AStuff)" -} - --- AStuff-hoverdef -- -```go -func a.AStuff() -``` - -[`a.AStuff` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#AStuff) --- S1-definition -- -godef/b/b.go:27:6-8: defined here as ```go -type S1 struct { - F1 int //@mark(S1F1, "F1") - S2 //@godef("S2", S2),mark(S1S2, "S2") - a.A //@godef("A", AString) - aAlias //@godef("a", aAlias) -} -``` - -[`b.S1` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/b?utm_source=gopls#S1) --- S1-definition-json -- -{ - "span": { - "uri": "file://godef/b/b.go", - "start": { - "line": 27, - "column": 6, - "offset": 587 - }, - "end": { - "line": 27, - "column": 8, - "offset": 589 - } - }, - "description": "```go\ntype S1 struct {\n\tF1 int //@mark(S1F1, \"F1\")\n\tS2 //@godef(\"S2\", S2),mark(S1S2, \"S2\")\n\ta.A //@godef(\"A\", AString)\n\taAlias //@godef(\"a\", aAlias)\n}\n```\n\n[`b.S1` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/b?utm_source=gopls#S1)" -} - --- S1-hoverdef -- -```go -type S1 struct { - F1 int //@mark(S1F1, "F1") - S2 //@godef("S2", S2),mark(S1S2, "S2") - a.A //@godef("A", AString) - aAlias //@godef("a", aAlias) -} -``` - -[`b.S1` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/b?utm_source=gopls#S1) --- S1F1-definition -- -godef/b/b.go:28:2-4: defined here as ```go -field F1 int -``` - -\@mark\(S1F1, \"F1\"\) - -[`(b.S1).F1` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/b?utm_source=gopls#S1.F1) --- S1F1-definition-json -- -{ - "span": { - "uri": "file://godef/b/b.go", - "start": { - "line": 28, - "column": 2, - "offset": 606 - }, - "end": { - "line": 28, - "column": 4, - "offset": 608 - } - }, - "description": "```go\nfield F1 int\n```\n\n\\@mark\\(S1F1, \\\"F1\\\"\\)\n\n[`(b.S1).F1` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/b?utm_source=gopls#S1.F1)" -} - --- S1F1-hoverdef -- -```go -field F1 int -``` - -\@mark\(S1F1, \"F1\"\) - -[`(b.S1).F1` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/b?utm_source=gopls#S1.F1) --- S1S2-definition -- -godef/b/b.go:29:2-4: defined here as ```go -field S2 S2 -``` - -\@godef\(\"S2\", S2\),mark\(S1S2, \"S2\"\) - -[`(b.S1).S2` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/b?utm_source=gopls#S1.S2) --- S1S2-definition-json -- -{ - "span": { - "uri": "file://godef/b/b.go", - "start": { - "line": 29, - "column": 2, - "offset": 638 - }, - "end": { - "line": 29, - "column": 4, - "offset": 640 - } - }, - "description": "```go\nfield S2 S2\n```\n\n\\@godef\\(\\\"S2\\\", S2\\),mark\\(S1S2, \\\"S2\\\"\\)\n\n[`(b.S1).S2` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/b?utm_source=gopls#S1.S2)" -} - --- S1S2-hoverdef -- -```go -field S2 S2 -``` - -\@godef\(\"S2\", S2\),mark\(S1S2, \"S2\"\) - -[`(b.S1).S2` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/b?utm_source=gopls#S1.S2) --- S2-definition -- -godef/b/b.go:34:6-8: defined here as ```go -type S2 struct { - F1 string //@mark(S2F1, "F1") - F2 int //@mark(S2F2, "F2") - *a.A //@godef("A", AString),godef("a",AImport) -} -``` - -[`b.S2` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/b?utm_source=gopls#S2) --- S2-definition-json -- -{ - "span": { - "uri": "file://godef/b/b.go", - "start": { - "line": 34, - "column": 6, - "offset": 762 - }, - "end": { - "line": 34, - "column": 8, - "offset": 764 - } - }, - "description": "```go\ntype S2 struct {\n\tF1 string //@mark(S2F1, \"F1\")\n\tF2 int //@mark(S2F2, \"F2\")\n\t*a.A //@godef(\"A\", AString),godef(\"a\",AImport)\n}\n```\n\n[`b.S2` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/b?utm_source=gopls#S2)" -} - --- S2-hoverdef -- -```go -type S2 struct { - F1 string //@mark(S2F1, "F1") - F2 int //@mark(S2F2, "F2") - *a.A //@godef("A", AString),godef("a",AImport) -} -``` - -[`b.S2` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/b?utm_source=gopls#S2) --- S2F1-definition -- -godef/b/b.go:35:2-4: defined here as ```go -field F1 string -``` - -\@mark\(S2F1, \"F1\"\) - -[`(b.S2).F1` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/b?utm_source=gopls#S2.F1) --- S2F1-definition-json -- -{ - "span": { - "uri": "file://godef/b/b.go", - "start": { - "line": 35, - "column": 2, - "offset": 781 - }, - "end": { - "line": 35, - "column": 4, - "offset": 783 - } - }, - "description": "```go\nfield F1 string\n```\n\n\\@mark\\(S2F1, \\\"F1\\\"\\)\n\n[`(b.S2).F1` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/b?utm_source=gopls#S2.F1)" -} - --- S2F1-hoverdef -- -```go -field F1 string -``` - -\@mark\(S2F1, \"F1\"\) - -[`(b.S2).F1` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/b?utm_source=gopls#S2.F1) --- S2F2-definition -- -godef/b/b.go:36:2-4: defined here as ```go -field F2 int -``` - -\@mark\(S2F2, \"F2\"\) - -[`(b.S2).F2` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/b?utm_source=gopls#S2.F2) --- S2F2-definition-json -- -{ - "span": { - "uri": "file://godef/b/b.go", - "start": { - "line": 36, - "column": 2, - "offset": 814 - }, - "end": { - "line": 36, - "column": 4, - "offset": 816 - } - }, - "description": "```go\nfield F2 int\n```\n\n\\@mark\\(S2F2, \\\"F2\\\"\\)\n\n[`(b.S2).F2` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/b?utm_source=gopls#S2.F2)" -} - --- S2F2-hoverdef -- -```go -field F2 int -``` - -\@mark\(S2F2, \"F2\"\) - -[`(b.S2).F2` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/b?utm_source=gopls#S2.F2) --- aAlias-definition -- -godef/b/b.go:25:6-12: defined here as ```go -type aAlias = a.A -``` - -\@mark\(aAlias, \"aAlias\"\) --- aAlias-definition-json -- -{ - "span": { - "uri": "file://godef/b/b.go", - "start": { - "line": 25, - "column": 6, - "offset": 542 - }, - "end": { - "line": 25, - "column": 12, - "offset": 548 - } - }, - "description": "```go\ntype aAlias = a.A\n```\n\n\\@mark\\(aAlias, \\\"aAlias\\\"\\)" -} - --- aAlias-hoverdef -- -```go -type aAlias = a.A -``` - -\@mark\(aAlias, \"aAlias\"\) --- bX-definition -- -godef/b/b.go:57:7-8: defined here as ```go -const X untyped int = 0 -``` - -\@mark\(bX, \"X\"\),godef\(\"X\", bX\) - -[`b.X` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/b?utm_source=gopls#X) --- bX-definition-json -- -{ - "span": { - "uri": "file://godef/b/b.go", - "start": { - "line": 57, - "column": 7, - "offset": 1249 - }, - "end": { - "line": 57, - "column": 8, - "offset": 1250 - } - }, - "description": "```go\nconst X untyped int = 0\n```\n\n\\@mark\\(bX, \\\"X\\\"\\),godef\\(\\\"X\\\", bX\\)\n\n[`b.X` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/b?utm_source=gopls#X)" -} - --- bX-hoverdef -- -```go -const X untyped int = 0 -``` - -\@mark\(bX, \"X\"\),godef\(\"X\", bX\) - -[`b.X` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/b?utm_source=gopls#X) --- myFoo-definition -- -godef/b/b.go:4:2-7: defined here as ```go -package myFoo ("golang.org/x/tools/internal/lsp/foo") -``` - -[`myFoo` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/foo?utm_source=gopls) --- myFoo-definition-json -- -{ - "span": { - "uri": "file://godef/b/b.go", - "start": { - "line": 4, - "column": 2, - "offset": 21 - }, - "end": { - "line": 4, - "column": 7, - "offset": 26 - } - }, - "description": "```go\npackage myFoo (\"golang.org/x/tools/internal/lsp/foo\")\n```\n\n[`myFoo` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/foo?utm_source=gopls)" -} - --- myFoo-hoverdef -- -```go -package myFoo ("golang.org/x/tools/internal/lsp/foo") -``` - -[`myFoo` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/foo?utm_source=gopls) diff --git a/internal/lsp/testdata/godef/b/c.go b/internal/lsp/testdata/godef/b/c.go deleted file mode 100644 index c8daf6242..000000000 --- a/internal/lsp/testdata/godef/b/c.go +++ /dev/null @@ -1,8 +0,0 @@ -package b - -// This is the in-editor version of the file. -// The on-disk version is in c.go.saved. - -var _ = S1{ //@godef("S1", S1) - F1: 99, //@godef("F1", S1F1) -} diff --git a/internal/lsp/testdata/godef/b/c.go.golden b/internal/lsp/testdata/godef/b/c.go.golden deleted file mode 100644 index e6205b726..000000000 --- a/internal/lsp/testdata/godef/b/c.go.golden +++ /dev/null @@ -1,74 +0,0 @@ --- S1-definition -- -godef/b/b.go:27:6-8: defined here as ```go -type S1 struct { - F1 int //@mark(S1F1, "F1") - S2 //@godef("S2", S2),mark(S1S2, "S2") - a.A //@godef("A", AString) - aAlias //@godef("a", aAlias) -} -``` - -[`b.S1` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/b?utm_source=gopls#S1) --- S1-definition-json -- -{ - "span": { - "uri": "file://godef/b/b.go", - "start": { - "line": 27, - "column": 6, - "offset": 587 - }, - "end": { - "line": 27, - "column": 8, - "offset": 589 - } - }, - "description": "```go\ntype S1 struct {\n\tF1 int //@mark(S1F1, \"F1\")\n\tS2 //@godef(\"S2\", S2),mark(S1S2, \"S2\")\n\ta.A //@godef(\"A\", AString)\n\taAlias //@godef(\"a\", aAlias)\n}\n```\n\n[`b.S1` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/b?utm_source=gopls#S1)" -} - --- S1-hoverdef -- -```go -type S1 struct { - F1 int //@mark(S1F1, "F1") - S2 //@godef("S2", S2),mark(S1S2, "S2") - a.A //@godef("A", AString) - aAlias //@godef("a", aAlias) -} -``` - -[`b.S1` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/b?utm_source=gopls#S1) --- S1F1-definition -- -godef/b/b.go:28:2-4: defined here as ```go -field F1 int -``` - -\@mark\(S1F1, \"F1\"\) - -[`(b.S1).F1` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/b?utm_source=gopls#S1.F1) --- S1F1-definition-json -- -{ - "span": { - "uri": "file://godef/b/b.go", - "start": { - "line": 28, - "column": 2, - "offset": 606 - }, - "end": { - "line": 28, - "column": 4, - "offset": 608 - } - }, - "description": "```go\nfield F1 int\n```\n\n\\@mark\\(S1F1, \\\"F1\\\"\\)\n\n[`(b.S1).F1` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/b?utm_source=gopls#S1.F1)" -} - --- S1F1-hoverdef -- -```go -field F1 int -``` - -\@mark\(S1F1, \"F1\"\) - -[`(b.S1).F1` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/b?utm_source=gopls#S1.F1) diff --git a/internal/lsp/testdata/godef/b/c.go.saved b/internal/lsp/testdata/godef/b/c.go.saved deleted file mode 100644 index ff1a8794b..000000000 --- a/internal/lsp/testdata/godef/b/c.go.saved +++ /dev/null @@ -1,7 +0,0 @@ -package b - -// This is the on-disk version of c.go, which represents -// the in-editor version of the file. - -} - diff --git a/internal/lsp/testdata/godef/b/e.go b/internal/lsp/testdata/godef/b/e.go deleted file mode 100644 index 7b96cd7e8..000000000 --- a/internal/lsp/testdata/godef/b/e.go +++ /dev/null @@ -1,31 +0,0 @@ -package b - -import ( - "fmt" - - "golang.org/x/tools/internal/lsp/godef/a" -) - -func useThings() { - t := a.Thing{} //@mark(bStructType, "ing") - fmt.Print(t.Member) //@mark(bMember, "ember") - fmt.Print(a.Other) //@mark(bVar, "ther") - a.Things() //@mark(bFunc, "ings") -} - -/*@ -godef(bStructType, Thing) -godef(bMember, Member) -godef(bVar, Other) -godef(bFunc, Things) -*/ - -func _() { - var x interface{} //@mark(eInterface, "interface{}") - switch x := x.(type) { //@hoverdef("x", eInterface) - case string: //@mark(eString, "string") - fmt.Println(x) //@hoverdef("x", eString) - case int: //@mark(eInt, "int") - fmt.Println(x) //@hoverdef("x", eInt) - } -} diff --git a/internal/lsp/testdata/godef/b/e.go.golden b/internal/lsp/testdata/godef/b/e.go.golden deleted file mode 100644 index f9af7b743..000000000 --- a/internal/lsp/testdata/godef/b/e.go.golden +++ /dev/null @@ -1,144 +0,0 @@ --- Member-definition -- -godef/a/d.go:6:2-8: defined here as ```go -field Member string -``` - -\@Member - -[`(a.Thing).Member` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Thing.Member) --- Member-definition-json -- -{ - "span": { - "uri": "file://godef/a/d.go", - "start": { - "line": 6, - "column": 2, - "offset": 90 - }, - "end": { - "line": 6, - "column": 8, - "offset": 96 - } - }, - "description": "```go\nfield Member string\n```\n\n\\@Member\n\n[`(a.Thing).Member` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Thing.Member)" -} - --- Member-hoverdef -- -```go -field Member string -``` - -\@Member - -[`(a.Thing).Member` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Thing.Member) --- Other-definition -- -godef/a/d.go:9:5-10: defined here as ```go -var a.Other a.Thing -``` - -\@Other - -[`a.Other` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Other) --- Other-definition-json -- -{ - "span": { - "uri": "file://godef/a/d.go", - "start": { - "line": 9, - "column": 5, - "offset": 121 - }, - "end": { - "line": 9, - "column": 10, - "offset": 126 - } - }, - "description": "```go\nvar a.Other a.Thing\n```\n\n\\@Other\n\n[`a.Other` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Other)" -} - --- Other-hoverdef -- -```go -var a.Other a.Thing -``` - -\@Other - -[`a.Other` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Other) --- Thing-definition -- -godef/a/d.go:5:6-11: defined here as ```go -type Thing struct { - Member string //@Member -} -``` - -[`a.Thing` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Thing) --- Thing-definition-json -- -{ - "span": { - "uri": "file://godef/a/d.go", - "start": { - "line": 5, - "column": 6, - "offset": 65 - }, - "end": { - "line": 5, - "column": 11, - "offset": 70 - } - }, - "description": "```go\ntype Thing struct {\n\tMember string //@Member\n}\n```\n\n[`a.Thing` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Thing)" -} - --- Thing-hoverdef -- -```go -type Thing struct { - Member string //@Member -} -``` - -[`a.Thing` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Thing) --- Things-definition -- -godef/a/d.go:11:6-12: defined here as ```go -func a.Things(val []string) []a.Thing -``` - -[`a.Things` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Things) --- Things-definition-json -- -{ - "span": { - "uri": "file://godef/a/d.go", - "start": { - "line": 11, - "column": 6, - "offset": 148 - }, - "end": { - "line": 11, - "column": 12, - "offset": 154 - } - }, - "description": "```go\nfunc a.Things(val []string) []a.Thing\n```\n\n[`a.Things` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Things)" -} - --- Things-hoverdef -- -```go -func a.Things(val []string) []a.Thing -``` - -[`a.Things` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#Things) --- eInt-hoverdef -- -```go -var x int -``` --- eInterface-hoverdef -- -```go -var x interface{} -``` --- eString-hoverdef -- -```go -var x string -``` diff --git a/internal/lsp/testdata/godef/b/h.go b/internal/lsp/testdata/godef/b/h.go deleted file mode 100644 index c8cbe850f..000000000 --- a/internal/lsp/testdata/godef/b/h.go +++ /dev/null @@ -1,10 +0,0 @@ -package b - -import . "golang.org/x/tools/internal/lsp/godef/a" - -func _() { - // variable of type a.A - var _ A //@mark(AVariable, "_"),hoverdef("_", AVariable) - - AStuff() //@hoverdef("AStuff", AStuff) -} diff --git a/internal/lsp/testdata/godef/b/h.go.golden b/internal/lsp/testdata/godef/b/h.go.golden deleted file mode 100644 index f32f0264f..000000000 --- a/internal/lsp/testdata/godef/b/h.go.golden +++ /dev/null @@ -1,12 +0,0 @@ --- AStuff-hoverdef -- -```go -func AStuff() -``` - -[`a.AStuff` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/a?utm_source=gopls#AStuff) --- AVariable-hoverdef -- -```go -var _ A -``` - -variable of type a\.A diff --git a/internal/lsp/testdata/godef/broken/unclosedIf.go.golden b/internal/lsp/testdata/godef/broken/unclosedIf.go.golden deleted file mode 100644 index 5c3329d8b..000000000 --- a/internal/lsp/testdata/godef/broken/unclosedIf.go.golden +++ /dev/null @@ -1,30 +0,0 @@ --- myUnclosedIf-definition -- -godef/broken/unclosedIf.go:7:7-19: defined here as ```go -var myUnclosedIf string -``` - -\@myUnclosedIf --- myUnclosedIf-definition-json -- -{ - "span": { - "uri": "file://godef/broken/unclosedIf.go", - "start": { - "line": 7, - "column": 7, - "offset": 68 - }, - "end": { - "line": 7, - "column": 19, - "offset": 80 - } - }, - "description": "```go\nvar myUnclosedIf string\n```\n\n\\@myUnclosedIf" -} - --- myUnclosedIf-hoverdef -- -```go -var myUnclosedIf string -``` - -\@myUnclosedIf diff --git a/internal/lsp/testdata/godef/broken/unclosedIf.go.in b/internal/lsp/testdata/godef/broken/unclosedIf.go.in deleted file mode 100644 index 0f2cf1b1e..000000000 --- a/internal/lsp/testdata/godef/broken/unclosedIf.go.in +++ /dev/null @@ -1,9 +0,0 @@ -package broken - -import "fmt" - -func unclosedIf() { - if false { - var myUnclosedIf string //@myUnclosedIf - fmt.Printf("s = %v\n", myUnclosedIf) //@godef("my", myUnclosedIf) -} diff --git a/internal/lsp/testdata/godef/hover_generics/hover.go b/internal/lsp/testdata/godef/hover_generics/hover.go deleted file mode 100644 index 7400e1acd..000000000 --- a/internal/lsp/testdata/godef/hover_generics/hover.go +++ /dev/null @@ -1,15 +0,0 @@ -package hover - -type value[T any] struct { //@mark(value, "value"),hoverdef("value", value),mark(valueTdecl, "T"),hoverdef("T",valueTdecl) - val T //@mark(valueTparam, "T"),hoverdef("T", valueTparam) - Q int //@mark(valueQfield, "Q"),hoverdef("Q", valueQfield) -} - -type Value[T any] struct { //@mark(ValueTdecl, "T"),hoverdef("T",ValueTdecl) - val T //@mark(ValueTparam, "T"),hoverdef("T", ValueTparam) - Q int //@mark(ValueQfield, "Q"),hoverdef("Q", ValueQfield) -} - -func F[P interface{ ~int | string }]() { //@mark(Pparam, "P"),hoverdef("P",Pparam) - var _ P //@mark(Pvar, "P"),hoverdef("P",Pvar) -} diff --git a/internal/lsp/testdata/godef/hover_generics/hover.go.golden b/internal/lsp/testdata/godef/hover_generics/hover.go.golden deleted file mode 100644 index cfebcc472..000000000 --- a/internal/lsp/testdata/godef/hover_generics/hover.go.golden +++ /dev/null @@ -1,45 +0,0 @@ --- Pparam-hoverdef -- -```go -type parameter P interface{~int|string} -``` --- Pvar-hoverdef -- -```go -type parameter P interface{~int|string} -``` --- ValueQfield-hoverdef -- -```go -field Q int -``` - -\@mark\(ValueQfield, \"Q\"\),hoverdef\(\"Q\", ValueQfield\) - -[`(hover.Value).Q` on pkg.go.dev](https://pkg.go.dev/golang.org/x/tools/internal/lsp/godef/hover_generics?utm_source=gopls#Value.Q) --- ValueTdecl-hoverdef -- -```go -type parameter T any -``` --- ValueTparam-hoverdef -- -```go -type parameter T any -``` --- value-hoverdef -- -```go -type value[T any] struct { - val T //@mark(valueTparam, "T"),hoverdef("T", valueTparam) - Q int //@mark(valueQfield, "Q"),hoverdef("Q", valueQfield) -} -``` --- valueQfield-hoverdef -- -```go -field Q int -``` - -\@mark\(valueQfield, \"Q\"\),hoverdef\(\"Q\", valueQfield\) --- valueTdecl-hoverdef -- -```go -type parameter T any -``` --- valueTparam-hoverdef -- -```go -type parameter T any -``` diff --git a/internal/lsp/testdata/godef/infer_generics/inferred.go b/internal/lsp/testdata/godef/infer_generics/inferred.go deleted file mode 100644 index 2d92a9590..000000000 --- a/internal/lsp/testdata/godef/infer_generics/inferred.go +++ /dev/null @@ -1,12 +0,0 @@ -package inferred - -func app[S interface{ ~[]E }, E interface{}](s S, e E) S { - return append(s, e) -} - -func _() { - _ = app[[]int] //@mark(constrInfer, "app"),hoverdef("app", constrInfer) - _ = app[[]int, int] //@mark(instance, "app"),hoverdef("app", instance) - _ = app[[]int]([]int{}, 0) //@mark(partialInfer, "app"),hoverdef("app", partialInfer) - _ = app([]int{}, 0) //@mark(argInfer, "app"),hoverdef("app", argInfer) -} diff --git a/internal/lsp/testdata/godef/infer_generics/inferred.go.golden b/internal/lsp/testdata/godef/infer_generics/inferred.go.golden deleted file mode 100644 index 4a36ff460..000000000 --- a/internal/lsp/testdata/godef/infer_generics/inferred.go.golden +++ /dev/null @@ -1,20 +0,0 @@ --- argInfer-hoverdef -- -```go -func app(s []int, e int) []int // func[S interface{~[]E}, E interface{}](s S, e E) S -``` --- constrInf-hoverdef -- -```go -func app(s []int, e int) []int // func[S₁ interface{~[]E₂}, E₂ interface{}](s S₁, e E₂) S₁ -``` --- constrInfer-hoverdef -- -```go -func app(s []int, e int) []int // func[S interface{~[]E}, E interface{}](s S, e E) S -``` --- instance-hoverdef -- -```go -func app(s []int, e int) []int // func[S interface{~[]E}, E interface{}](s S, e E) S -``` --- partialInfer-hoverdef -- -```go -func app(s []int, e int) []int // func[S interface{~[]E}, E interface{}](s S, e E) S -``` diff --git a/internal/lsp/testdata/good/good0.go b/internal/lsp/testdata/good/good0.go deleted file mode 100644 index 89450a845..000000000 --- a/internal/lsp/testdata/good/good0.go +++ /dev/null @@ -1,6 +0,0 @@ -package good //@diag("package", "no_diagnostics", "", "error") - -func stuff() { //@item(good_stuff, "stuff", "func()", "func"),prepare("stu", "stuff", "stuff") - x := 5 - random2(x) //@prepare("dom", "random2", "random2") -} diff --git a/internal/lsp/testdata/good/good1.go b/internal/lsp/testdata/good/good1.go deleted file mode 100644 index c4664a7e5..000000000 --- a/internal/lsp/testdata/good/good1.go +++ /dev/null @@ -1,20 +0,0 @@ -package good //@diag("package", "no_diagnostics", "", "error") - -import ( - "golang.org/x/tools/internal/lsp/types" //@item(types_import, "types", "\"golang.org/x/tools/internal/lsp/types\"", "package") -) - -func random() int { //@item(good_random, "random", "func() int", "func") - _ = "random() int" //@prepare("random", "", "") - y := 6 + 7 //@prepare("7", "", "") - return y //@prepare("return", "","") -} - -func random2(y int) int { //@item(good_random2, "random2", "func(y int) int", "func"),item(good_y_param, "y", "int", "var") - //@complete("", good_y_param, types_import, good_random, good_random2, good_stuff) - var b types.Bob = &types.X{} //@prepare("ypes","types", "types") - if _, ok := b.(*types.X); ok { //@complete("X", X_struct, Y_struct, Bob_interface, CoolAlias) - } - - return y -} diff --git a/internal/lsp/testdata/highlights/highlights.go b/internal/lsp/testdata/highlights/highlights.go deleted file mode 100644 index 55ae68aa1..000000000 --- a/internal/lsp/testdata/highlights/highlights.go +++ /dev/null @@ -1,151 +0,0 @@ -package highlights - -import ( - "fmt" //@mark(fmtImp, "\"fmt\""),highlight(fmtImp, fmtImp, fmt1, fmt2, fmt3, fmt4) - h2 "net/http" //@mark(hImp, "h2"),highlight(hImp, hImp, hUse) - "sort" -) - -type F struct{ bar int } //@mark(barDeclaration, "bar"),highlight(barDeclaration, barDeclaration, bar1, bar2, bar3) - -func _() F { - return F{ - bar: 123, //@mark(bar1, "bar"),highlight(bar1, barDeclaration, bar1, bar2, bar3) - } -} - -var foo = F{bar: 52} //@mark(fooDeclaration, "foo"),mark(bar2, "bar"),highlight(fooDeclaration, fooDeclaration, fooUse),highlight(bar2, barDeclaration, bar1, bar2, bar3) - -func Print() { //@mark(printFunc, "Print"),highlight(printFunc, printFunc, printTest) - _ = h2.Client{} //@mark(hUse, "h2"),highlight(hUse, hImp, hUse) - - fmt.Println(foo) //@mark(fooUse, "foo"),highlight(fooUse, fooDeclaration, fooUse),mark(fmt1, "fmt"),highlight(fmt1, fmtImp, fmt1, fmt2, fmt3, fmt4) - fmt.Print("yo") //@mark(printSep, "Print"),highlight(printSep, printSep, print1, print2),mark(fmt2, "fmt"),highlight(fmt2, fmtImp, fmt1, fmt2, fmt3, fmt4) -} - -func (x *F) Inc() { //@mark(xRightDecl, "x"),mark(xLeftDecl, " *"),highlight(xRightDecl, xRightDecl, xUse),highlight(xLeftDecl, xRightDecl, xUse) - x.bar++ //@mark(xUse, "x"),mark(bar3, "bar"),highlight(xUse, xRightDecl, xUse),highlight(bar3, barDeclaration, bar1, bar2, bar3) -} - -func testFunctions() { - fmt.Print("main start") //@mark(print1, "Print"),highlight(print1, printSep, print1, print2),mark(fmt3, "fmt"),highlight(fmt3, fmtImp, fmt1, fmt2, fmt3, fmt4) - fmt.Print("ok") //@mark(print2, "Print"),highlight(print2, printSep, print1, print2),mark(fmt4, "fmt"),highlight(fmt4, fmtImp, fmt1, fmt2, fmt3, fmt4) - Print() //@mark(printTest, "Print"),highlight(printTest, printFunc, printTest) -} - -func toProtocolHighlight(rngs []int) []DocumentHighlight { //@mark(doc1, "DocumentHighlight"),mark(docRet1, "[]DocumentHighlight"),highlight(doc1, docRet1, doc1, doc2, doc3, result) - result := make([]DocumentHighlight, 0, len(rngs)) //@mark(doc2, "DocumentHighlight"),highlight(doc2, doc1, doc2, doc3) - for _, rng := range rngs { - result = append(result, DocumentHighlight{ //@mark(doc3, "DocumentHighlight"),highlight(doc3, doc1, doc2, doc3) - Range: rng, - }) - } - return result //@mark(result, "result") -} - -func testForLoops() { - for i := 0; i < 10; i++ { //@mark(forDecl1, "for"),highlight(forDecl1, forDecl1, brk1, cont1) - if i > 8 { - break //@mark(brk1, "break"),highlight(brk1, forDecl1, brk1, cont1) - } - if i < 2 { - for j := 1; j < 10; j++ { //@mark(forDecl2, "for"),highlight(forDecl2, forDecl2, cont2) - if j < 3 { - for k := 1; k < 10; k++ { //@mark(forDecl3, "for"),highlight(forDecl3, forDecl3, cont3) - if k < 3 { - continue //@mark(cont3, "continue"),highlight(cont3, forDecl3, cont3) - } - } - continue //@mark(cont2, "continue"),highlight(cont2, forDecl2, cont2) - } - } - continue //@mark(cont1, "continue"),highlight(cont1, forDecl1, brk1, cont1) - } - } - - arr := []int{} - for i := range arr { //@mark(forDecl4, "for"),highlight(forDecl4, forDecl4, brk4, cont4) - if i > 8 { - break //@mark(brk4, "break"),highlight(brk4, forDecl4, brk4, cont4) - } - if i < 4 { - continue //@mark(cont4, "continue"),highlight(cont4, forDecl4, brk4, cont4) - } - } - -Outer: - for i := 0; i < 10; i++ { //@mark(forDecl5, "for"),highlight(forDecl5, forDecl5, brk5, brk6, brk8) - break //@mark(brk5, "break"),highlight(brk5, forDecl5, brk5, brk6, brk8) - for { //@mark(forDecl6, "for"),highlight(forDecl6, forDecl6, cont5) - if i == 1 { - break Outer //@mark(brk6, "break Outer"),highlight(brk6, forDecl5, brk5, brk6, brk8) - } - switch i { //@mark(switch1, "switch"),highlight(switch1, switch1, brk7) - case 5: - break //@mark(brk7, "break"),highlight(brk7, switch1, brk7) - case 6: - continue //@mark(cont5, "continue"),highlight(cont5, forDecl6, cont5) - case 7: - break Outer //@mark(brk8, "break Outer"),highlight(brk8, forDecl5, brk5, brk6, brk8) - } - } - } -} - -func testSwitch() { - var i, j int - -L1: - for { //@mark(forDecl7, "for"),highlight(forDecl7, forDecl7, brk10, cont6) - L2: - switch i { //@mark(switch2, "switch"),highlight(switch2, switch2, brk11, brk12, brk13) - case 1: - switch j { //@mark(switch3, "switch"),highlight(switch3, switch3, brk9) - case 1: - break //@mark(brk9, "break"),highlight(brk9, switch3, brk9) - case 2: - break L1 //@mark(brk10, "break L1"),highlight(brk10, forDecl7, brk10, cont6) - case 3: - break L2 //@mark(brk11, "break L2"),highlight(brk11, switch2, brk11, brk12, brk13) - default: - continue //@mark(cont6, "continue"),highlight(cont6, forDecl7, brk10, cont6) - } - case 2: - break //@mark(brk12, "break"),highlight(brk12, switch2, brk11, brk12, brk13) - default: - break L2 //@mark(brk13, "break L2"),highlight(brk13, switch2, brk11, brk12, brk13) - } - } -} - -func testReturn() bool { //@mark(func1, "func"),mark(bool1, "bool"),highlight(func1, func1, fullRet11, fullRet12),highlight(bool1, bool1, false1, bool2, true1) - if 1 < 2 { - return false //@mark(ret11, "return"),mark(fullRet11, "return false"),mark(false1, "false"),highlight(ret11, func1, fullRet11, fullRet12) - } - candidates := []int{} - sort.SliceStable(candidates, func(i, j int) bool { //@mark(func2, "func"),mark(bool2, "bool"),highlight(func2, func2, fullRet2) - return candidates[i] > candidates[j] //@mark(ret2, "return"),mark(fullRet2, "return candidates[i] > candidates[j]"),highlight(ret2, func2, fullRet2) - }) - return true //@mark(ret12, "return"),mark(fullRet12, "return true"),mark(true1, "true"),highlight(ret12, func1, fullRet11, fullRet12) -} - -func testReturnFields() float64 { //@mark(retVal1, "float64"),highlight(retVal1, retVal1, retVal11, retVal21) - if 1 < 2 { - return 20.1 //@mark(retVal11, "20.1"),highlight(retVal11, retVal1, retVal11, retVal21) - } - z := 4.3 //@mark(zDecl, "z") - return z //@mark(retVal21, "z"),highlight(retVal21, retVal1, retVal11, zDecl, retVal21) -} - -func testReturnMultipleFields() (float32, string) { //@mark(retVal31, "float32"),mark(retVal32, "string"),highlight(retVal31, retVal31, retVal41, retVal51),highlight(retVal32, retVal32, retVal42, retVal52) - y := "im a var" //@mark(yDecl, "y"), - if 1 < 2 { - return 20.1, y //@mark(retVal41, "20.1"),mark(retVal42, "y"),highlight(retVal41, retVal31, retVal41, retVal51),highlight(retVal42, retVal32, yDecl, retVal42, retVal52) - } - return 4.9, "test" //@mark(retVal51, "4.9"),mark(retVal52, "\"test\""),highlight(retVal51, retVal31, retVal41, retVal51),highlight(retVal52, retVal32, retVal42, retVal52) -} - -func testReturnFunc() int32 { //@mark(retCall, "int32") - mulch := 1 //@mark(mulchDec, "mulch"),highlight(mulchDec, mulchDec, mulchRet) - return int32(mulch) //@mark(mulchRet, "mulch"),mark(retFunc, "int32"),mark(retTotal, "int32(mulch)"),highlight(mulchRet, mulchDec, mulchRet),highlight(retFunc, retCall, retFunc, retTotal) -} diff --git a/internal/lsp/testdata/implementation/implementation.go b/internal/lsp/testdata/implementation/implementation.go deleted file mode 100644 index c3229121a..000000000 --- a/internal/lsp/testdata/implementation/implementation.go +++ /dev/null @@ -1,31 +0,0 @@ -package implementation - -import "golang.org/x/tools/internal/lsp/implementation/other" - -type ImpP struct{} //@ImpP,implementations("ImpP", Laugher, OtherLaugher) - -func (*ImpP) Laugh() { //@mark(LaughP, "Laugh"),implementations("Laugh", Laugh, OtherLaugh) -} - -type ImpS struct{} //@ImpS,implementations("ImpS", Laugher, OtherLaugher) - -func (ImpS) Laugh() { //@mark(LaughS, "Laugh"),implementations("Laugh", Laugh, OtherLaugh) -} - -type Laugher interface { //@Laugher,implementations("Laugher", ImpP, OtherImpP, ImpS, OtherImpS) - Laugh() //@Laugh,implementations("Laugh", LaughP, OtherLaughP, LaughS, OtherLaughS) -} - -type Foo struct { //@implementations("Foo", Joker) - other.Foo -} - -type Joker interface { //@Joker - Joke() //@Joke,implementations("Joke", ImpJoker) -} - -type cryer int //@implementations("cryer", Cryer) - -func (cryer) Cry(other.CryType) {} //@mark(CryImpl, "Cry"),implementations("Cry", Cry) - -type Empty interface{} //@implementations("Empty") diff --git a/internal/lsp/testdata/implementation/other/other.go b/internal/lsp/testdata/implementation/other/other.go deleted file mode 100644 index aff825e91..000000000 --- a/internal/lsp/testdata/implementation/other/other.go +++ /dev/null @@ -1,27 +0,0 @@ -package other - -type ImpP struct{} //@mark(OtherImpP, "ImpP") - -func (*ImpP) Laugh() { //@mark(OtherLaughP, "Laugh") -} - -type ImpS struct{} //@mark(OtherImpS, "ImpS") - -func (ImpS) Laugh() { //@mark(OtherLaughS, "Laugh") -} - -type ImpI interface { //@mark(OtherLaugher, "ImpI") - Laugh() //@mark(OtherLaugh, "Laugh") -} - -type Foo struct { //@implementations("Foo", Joker) -} - -func (Foo) Joke() { //@mark(ImpJoker, "Joke"),implementations("Joke", Joke) -} - -type CryType int - -type Cryer interface { //@Cryer - Cry(CryType) //@Cry,implementations("Cry", CryImpl) -} diff --git a/internal/lsp/testdata/implementation/other/other_test.go b/internal/lsp/testdata/implementation/other/other_test.go deleted file mode 100644 index 846e0d591..000000000 --- a/internal/lsp/testdata/implementation/other/other_test.go +++ /dev/null @@ -1,10 +0,0 @@ -package other - -import ( - "testing" -) - -// This exists so the other.test package comes into existence. - -func TestOther(t *testing.T) { -} diff --git a/internal/lsp/testdata/importedcomplit/imported_complit.go.in b/internal/lsp/testdata/importedcomplit/imported_complit.go.in deleted file mode 100644 index 80d85245c..000000000 --- a/internal/lsp/testdata/importedcomplit/imported_complit.go.in +++ /dev/null @@ -1,42 +0,0 @@ -package importedcomplit - -import ( - "golang.org/x/tools/internal/lsp/foo" - - // import completions - "fm" //@complete("\" //", fmtImport) - "go/pars" //@complete("\" //", parserImport) - "golang.org/x/tools/internal/lsp/signa" //@complete("na\" //", signatureImport) - "golang.org/x/too" //@complete("\" //", toolsImport) - "crypto/elli" //@complete("\" //", cryptoImport) - "golang.org/x/tools/internal/lsp/sign" //@complete("\" //", signatureImport) - "golang.org/x/tools/internal/lsp/sign" //@complete("ols", toolsImport) - namedParser "go/pars" //@complete("\" //", parserImport) -) - -func _() { - var V int //@item(icVVar, "V", "int", "var") - _ = foo.StructFoo{V} //@complete("}", Value, icVVar) -} - -func _() { - var ( - aa string //@item(icAAVar, "aa", "string", "var") - ab int //@item(icABVar, "ab", "int", "var") - ) - - _ = foo.StructFoo{a} //@complete("}", abVar, aaVar) - - var s struct { - AA string //@item(icFieldAA, "AA", "string", "field") - AB int //@item(icFieldAB, "AB", "int", "field") - } - - _ = foo.StructFoo{s.} //@complete("}", icFieldAB, icFieldAA) -} - -/* "fmt" */ //@item(fmtImport, "fmt", "\"fmt\"", "package") -/* "go/parser" */ //@item(parserImport, "parser", "\"go/parser\"", "package") -/* "golang.org/x/tools/internal/lsp/signature" */ //@item(signatureImport, "signature", "\"golang.org/x/tools/internal/lsp/signature\"", "package") -/* "golang.org/x/tools/" */ //@item(toolsImport, "tools/", "\"golang.org/x/tools/\"", "package") -/* "crypto/elliptic" */ //@item(cryptoImport, "elliptic", "\"crypto/elliptic\"", "package") diff --git a/internal/lsp/testdata/imports/add_import.go.golden b/internal/lsp/testdata/imports/add_import.go.golden deleted file mode 100644 index 16af110a0..000000000 --- a/internal/lsp/testdata/imports/add_import.go.golden +++ /dev/null @@ -1,13 +0,0 @@ --- goimports -- -package imports //@import("package") - -import ( - "bytes" - "fmt" -) - -func _() { - fmt.Println("") - bytes.NewBuffer(nil) -} - diff --git a/internal/lsp/testdata/imports/add_import.go.in b/internal/lsp/testdata/imports/add_import.go.in deleted file mode 100644 index 7928e6f71..000000000 --- a/internal/lsp/testdata/imports/add_import.go.in +++ /dev/null @@ -1,10 +0,0 @@ -package imports //@import("package") - -import ( - "fmt" -) - -func _() { - fmt.Println("") - bytes.NewBuffer(nil) -} diff --git a/internal/lsp/testdata/imports/good_imports.go.golden b/internal/lsp/testdata/imports/good_imports.go.golden deleted file mode 100644 index 2abdae4d7..000000000 --- a/internal/lsp/testdata/imports/good_imports.go.golden +++ /dev/null @@ -1,9 +0,0 @@ --- goimports -- -package imports //@import("package") - -import "fmt" - -func _() { -fmt.Println("") -} - diff --git a/internal/lsp/testdata/imports/good_imports.go.in b/internal/lsp/testdata/imports/good_imports.go.in deleted file mode 100644 index a03c06c6d..000000000 --- a/internal/lsp/testdata/imports/good_imports.go.in +++ /dev/null @@ -1,7 +0,0 @@ -package imports //@import("package") - -import "fmt" - -func _() { -fmt.Println("") -} diff --git a/internal/lsp/testdata/imports/issue35458.go.golden b/internal/lsp/testdata/imports/issue35458.go.golden deleted file mode 100644 index f0772606b..000000000 --- a/internal/lsp/testdata/imports/issue35458.go.golden +++ /dev/null @@ -1,20 +0,0 @@ --- goimports -- -// package doc -package imports //@import("package") - - - - - - -func _() { - println("Hello, world!") -} - - - - - - - - diff --git a/internal/lsp/testdata/imports/issue35458.go.in b/internal/lsp/testdata/imports/issue35458.go.in deleted file mode 100644 index 7420c212c..000000000 --- a/internal/lsp/testdata/imports/issue35458.go.in +++ /dev/null @@ -1,23 +0,0 @@ - - - - - -// package doc -package imports //@import("package") - - - - - - -func _() { - println("Hello, world!") -} - - - - - - - diff --git a/internal/lsp/testdata/imports/multiple_blocks.go.golden b/internal/lsp/testdata/imports/multiple_blocks.go.golden deleted file mode 100644 index d37a6c751..000000000 --- a/internal/lsp/testdata/imports/multiple_blocks.go.golden +++ /dev/null @@ -1,9 +0,0 @@ --- goimports -- -package imports //@import("package") - -import "fmt" - -func _() { - fmt.Println("") -} - diff --git a/internal/lsp/testdata/imports/multiple_blocks.go.in b/internal/lsp/testdata/imports/multiple_blocks.go.in deleted file mode 100644 index 3f2fb99ea..000000000 --- a/internal/lsp/testdata/imports/multiple_blocks.go.in +++ /dev/null @@ -1,9 +0,0 @@ -package imports //@import("package") - -import "fmt" - -import "bytes" - -func _() { - fmt.Println("") -} diff --git a/internal/lsp/testdata/imports/needs_imports.go.golden b/internal/lsp/testdata/imports/needs_imports.go.golden deleted file mode 100644 index fd6032874..000000000 --- a/internal/lsp/testdata/imports/needs_imports.go.golden +++ /dev/null @@ -1,13 +0,0 @@ --- goimports -- -package imports //@import("package") - -import ( - "fmt" - "log" -) - -func goodbye() { - fmt.Printf("HI") - log.Printf("byeeeee") -} - diff --git a/internal/lsp/testdata/imports/needs_imports.go.in b/internal/lsp/testdata/imports/needs_imports.go.in deleted file mode 100644 index 949d56a64..000000000 --- a/internal/lsp/testdata/imports/needs_imports.go.in +++ /dev/null @@ -1,6 +0,0 @@ -package imports //@import("package") - -func goodbye() { - fmt.Printf("HI") - log.Printf("byeeeee") -} diff --git a/internal/lsp/testdata/imports/remove_import.go.golden b/internal/lsp/testdata/imports/remove_import.go.golden deleted file mode 100644 index 3df80882c..000000000 --- a/internal/lsp/testdata/imports/remove_import.go.golden +++ /dev/null @@ -1,11 +0,0 @@ --- goimports -- -package imports //@import("package") - -import ( - "fmt" -) - -func _() { - fmt.Println("") -} - diff --git a/internal/lsp/testdata/imports/remove_import.go.in b/internal/lsp/testdata/imports/remove_import.go.in deleted file mode 100644 index 09060bada..000000000 --- a/internal/lsp/testdata/imports/remove_import.go.in +++ /dev/null @@ -1,10 +0,0 @@ -package imports //@import("package") - -import ( - "bytes" - "fmt" -) - -func _() { - fmt.Println("") -} diff --git a/internal/lsp/testdata/imports/remove_imports.go.golden b/internal/lsp/testdata/imports/remove_imports.go.golden deleted file mode 100644 index 530c8c09f..000000000 --- a/internal/lsp/testdata/imports/remove_imports.go.golden +++ /dev/null @@ -1,6 +0,0 @@ --- goimports -- -package imports //@import("package") - -func _() { -} - diff --git a/internal/lsp/testdata/imports/remove_imports.go.in b/internal/lsp/testdata/imports/remove_imports.go.in deleted file mode 100644 index 44d065f25..000000000 --- a/internal/lsp/testdata/imports/remove_imports.go.in +++ /dev/null @@ -1,9 +0,0 @@ -package imports //@import("package") - -import ( - "bytes" - "fmt" -) - -func _() { -} diff --git a/internal/lsp/testdata/imports/two_lines.go.golden b/internal/lsp/testdata/imports/two_lines.go.golden deleted file mode 100644 index ec118a4dd..000000000 --- a/internal/lsp/testdata/imports/two_lines.go.golden +++ /dev/null @@ -1,4 +0,0 @@ --- goimports -- -package main -func main() {} //@import("main") - diff --git a/internal/lsp/testdata/imports/two_lines.go.in b/internal/lsp/testdata/imports/two_lines.go.in deleted file mode 100644 index eee534569..000000000 --- a/internal/lsp/testdata/imports/two_lines.go.in +++ /dev/null @@ -1,2 +0,0 @@ -package main -func main() {} //@import("main") diff --git a/internal/lsp/testdata/index/index.go b/internal/lsp/testdata/index/index.go deleted file mode 100644 index a2656893c..000000000 --- a/internal/lsp/testdata/index/index.go +++ /dev/null @@ -1,25 +0,0 @@ -package index - -func _() { - var ( - aa = "123" //@item(indexAA, "aa", "string", "var") - ab = 123 //@item(indexAB, "ab", "int", "var") - ) - - var foo [1]int - foo[a] //@complete("]", indexAB, indexAA) - foo[:a] //@complete("]", indexAB, indexAA) - a[:a] //@complete("[", indexAA, indexAB) - a[a] //@complete("[", indexAA, indexAB) - - var bar map[string]int - bar[a] //@complete("]", indexAA, indexAB) - - type myMap map[string]int - var baz myMap - baz[a] //@complete("]", indexAA, indexAB) - - type myInt int - var mi myInt //@item(indexMyInt, "mi", "myInt", "var") - foo[m] //@snippet("]", indexMyInt, "mi", "mi") -} diff --git a/internal/lsp/testdata/interfacerank/interface_rank.go b/internal/lsp/testdata/interfacerank/interface_rank.go deleted file mode 100644 index acb5a42e0..000000000 --- a/internal/lsp/testdata/interfacerank/interface_rank.go +++ /dev/null @@ -1,23 +0,0 @@ -package interfacerank - -type foo interface { - foo() -} - -type fooImpl int - -func (*fooImpl) foo() {} - -func wantsFoo(foo) {} - -func _() { - var ( - aa string //@item(irAA, "aa", "string", "var") - ab *fooImpl //@item(irAB, "ab", "*fooImpl", "var") - ) - - wantsFoo(a) //@complete(")", irAB, irAA) - - var ac fooImpl //@item(irAC, "ac", "fooImpl", "var") - wantsFoo(&a) //@complete(")", irAC, irAA, irAB) -} diff --git a/internal/lsp/testdata/keywords/accidental_keywords.go.in b/internal/lsp/testdata/keywords/accidental_keywords.go.in deleted file mode 100644 index 3833081c4..000000000 --- a/internal/lsp/testdata/keywords/accidental_keywords.go.in +++ /dev/null @@ -1,31 +0,0 @@ -package keywords - -// non-matching candidate - shouldn't show up as completion -var apple = "apple" - -func _() { - foo.bar() // insert some extra statements to exercise our AST surgery - variance := 123 //@item(kwVariance, "variance", "int", "var") - foo.bar() - println(var) //@complete(")", kwVariance) -} - -func _() { - foo.bar() - var s struct { variance int } //@item(kwVarianceField, "variance", "int", "field") - foo.bar() - s.var //@complete(" //", kwVarianceField) -} - -func _() { - channel := 123 //@item(kwChannel, "channel", "int", "var") - chan //@complete(" //", kwChannel) - foo.bar() -} - -func _() { - foo.bar() - var typeName string //@item(kwTypeName, "typeName", "string", "var") - foo.bar() - type //@complete(" //", kwTypeName) -} diff --git a/internal/lsp/testdata/keywords/empty_select.go b/internal/lsp/testdata/keywords/empty_select.go deleted file mode 100644 index 17ca3ec9d..000000000 --- a/internal/lsp/testdata/keywords/empty_select.go +++ /dev/null @@ -1,7 +0,0 @@ -package keywords - -func _() { - select { - c //@complete(" //", case) - } -} diff --git a/internal/lsp/testdata/keywords/empty_switch.go b/internal/lsp/testdata/keywords/empty_switch.go deleted file mode 100644 index 2004d5541..000000000 --- a/internal/lsp/testdata/keywords/empty_switch.go +++ /dev/null @@ -1,11 +0,0 @@ -package keywords - -func _() { - switch { - //@complete("", case, default) - } - - switch test.(type) { - d //@complete(" //", default) - } -} diff --git a/internal/lsp/testdata/keywords/keywords.go b/internal/lsp/testdata/keywords/keywords.go deleted file mode 100644 index 1fa2c12ba..000000000 --- a/internal/lsp/testdata/keywords/keywords.go +++ /dev/null @@ -1,100 +0,0 @@ -package keywords - -//@rank("", type),rank("", func),rank("", var),rank("", const),rank("", import) - -func _() { - var test int //@rank(" //", int, interface) - var tChan chan int - var _ m //@complete(" //", map) - var _ f //@complete(" //", func) - var _ c //@complete(" //", chan) - - var _ str //@rank(" //", string, struct) - - type _ int //@rank(" //", interface, int) - - type _ str //@rank(" //", struct, string) - - switch test { - case 1: // TODO: trying to complete case here will break because the parser wont return *ast.Ident - b //@complete(" //", break) - case 2: - f //@complete(" //", fallthrough, for) - r //@complete(" //", return) - d //@complete(" //", default, defer) - c //@complete(" //", case, const) - } - - switch test.(type) { - case fo: //@complete(":") - case int: - b //@complete(" //", break) - case int32: - f //@complete(" //", for) - d //@complete(" //", default, defer) - r //@complete(" //", return) - c //@complete(" //", case, const) - } - - select { - case <-tChan: - b //@complete(" //", break) - c //@complete(" //", case, const) - } - - for index := 0; index < test; index++ { - c //@complete(" //", const, continue) - b //@complete(" //", break) - } - - for range []int{} { - c //@complete(" //", const, continue) - b //@complete(" //", break) - } - - // Test function level keywords - - //Using 2 characters to test because map output order is random - sw //@complete(" //", switch) - se //@complete(" //", select) - - f //@complete(" //", for) - d //@complete(" //", defer) - g //@rank(" //", go),rank(" //", goto) - r //@complete(" //", return) - i //@complete(" //", if) - e //@complete(" //", else) - v //@complete(" //", var) - c //@complete(" //", const) - - for i := r //@complete(" //", range) -} - -/* package */ //@item(package, "package", "", "keyword") -/* import */ //@item(import, "import", "", "keyword") -/* func */ //@item(func, "func", "", "keyword") -/* type */ //@item(type, "type", "", "keyword") -/* var */ //@item(var, "var", "", "keyword") -/* const */ //@item(const, "const", "", "keyword") -/* break */ //@item(break, "break", "", "keyword") -/* default */ //@item(default, "default", "", "keyword") -/* case */ //@item(case, "case", "", "keyword") -/* defer */ //@item(defer, "defer", "", "keyword") -/* go */ //@item(go, "go", "", "keyword") -/* for */ //@item(for, "for", "", "keyword") -/* if */ //@item(if, "if", "", "keyword") -/* else */ //@item(else, "else", "", "keyword") -/* switch */ //@item(switch, "switch", "", "keyword") -/* select */ //@item(select, "select", "", "keyword") -/* fallthrough */ //@item(fallthrough, "fallthrough", "", "keyword") -/* continue */ //@item(continue, "continue", "", "keyword") -/* return */ //@item(return, "return", "", "keyword") -/* var */ //@item(var, "var", "", "keyword") -/* const */ //@item(const, "const", "", "keyword") -/* goto */ //@item(goto, "goto", "", "keyword") -/* struct */ //@item(struct, "struct", "", "keyword") -/* interface */ //@item(interface, "interface", "", "keyword") -/* map */ //@item(map, "map", "", "keyword") -/* func */ //@item(func, "func", "", "keyword") -/* chan */ //@item(chan, "chan", "", "keyword") -/* range */ //@item(range, "range", "", "keyword") diff --git a/internal/lsp/testdata/labels/labels.go b/internal/lsp/testdata/labels/labels.go deleted file mode 100644 index b9effb6d0..000000000 --- a/internal/lsp/testdata/labels/labels.go +++ /dev/null @@ -1,49 +0,0 @@ -package labels - -func _() { - goto F //@complete(" //", label1, label5) - -Foo1: //@item(label1, "Foo1", "label", "const") - for a, b := range []int{} { - Foo2: //@item(label2, "Foo2", "label", "const") - switch { - case true: - break F //@complete(" //", label2, label1) - - continue F //@complete(" //", label1) - - { - FooUnjumpable: - } - - goto F //@complete(" //", label1, label2, label4, label5) - - func() { - goto F //@complete(" //", label3) - - break F //@complete(" //") - - continue F //@complete(" //") - - Foo3: //@item(label3, "Foo3", "label", "const") - }() - } - - Foo4: //@item(label4, "Foo4", "label", "const") - switch interface{}(a).(type) { - case int: - break F //@complete(" //", label4, label1) - } - } - - break F //@complete(" //") - - continue F //@complete(" //") - -Foo5: //@item(label5, "Foo5", "label", "const") - for { - break F //@complete(" //", label5) - } - - return -} diff --git a/internal/lsp/testdata/links/links.go b/internal/lsp/testdata/links/links.go deleted file mode 100644 index 89492bafe..000000000 --- a/internal/lsp/testdata/links/links.go +++ /dev/null @@ -1,26 +0,0 @@ -package links - -import ( - "fmt" //@link(`fmt`,"https://pkg.go.dev/fmt?utm_source=gopls") - - "golang.org/x/tools/internal/lsp/foo" //@link(`golang.org/x/tools/internal/lsp/foo`,`https://pkg.go.dev/golang.org/x/tools/internal/lsp/foo?utm_source=gopls`) - - _ "database/sql" //@link(`database/sql`, `https://pkg.go.dev/database/sql?utm_source=gopls`) -) - -var ( - _ fmt.Formatter - _ foo.StructFoo - _ errors.Formatter -) - -// Foo function -func Foo() string { - /*https://example.com/comment */ //@link("https://example.com/comment","https://example.com/comment") - - url := "https://example.com/string_literal" //@link("https://example.com/string_literal","https://example.com/string_literal") - return url - - // TODO(golang/go#1234): Link the relevant issue. //@link("golang/go#1234", "https://github.com/golang/go/issues/1234") - // TODO(microsoft/vscode-go#12): Another issue. //@link("microsoft/vscode-go#12", "https://github.com/microsoft/vscode-go/issues/12") -} diff --git a/internal/lsp/testdata/maps/maps.go.in b/internal/lsp/testdata/maps/maps.go.in deleted file mode 100644 index eeb5576b0..000000000 --- a/internal/lsp/testdata/maps/maps.go.in +++ /dev/null @@ -1,18 +0,0 @@ -package maps - -func _() { - var aVar int //@item(mapVar, "aVar", "int", "var") - - // not comparabale - type aSlice []int //@item(mapSliceType, "aSlice", "[]int", "type") - - *aSlice //@item(mapSliceTypePtr, "*aSlice", "[]int", "type") - - // comparable - type aStruct struct{} //@item(mapStructType, "aStruct", "struct{...}", "struct") - - map[]a{} //@complete("]", mapSliceType, mapStructType),snippet("]", mapSliceType, "*aSlice", "*aSlice") - - map[a]a{} //@complete("]", mapSliceType, mapStructType) - map[a]a{} //@complete("{", mapSliceType, mapStructType) -} diff --git a/internal/lsp/testdata/missingfunction/channels.go b/internal/lsp/testdata/missingfunction/channels.go deleted file mode 100644 index 436491c19..000000000 --- a/internal/lsp/testdata/missingfunction/channels.go +++ /dev/null @@ -1,9 +0,0 @@ -package missingfunction - -func channels(s string) { - undefinedChannels(c()) //@suggestedfix("undefinedChannels", "quickfix") -} - -func c() (<-chan string, chan string) { - return make(<-chan string), make(chan string) -} diff --git a/internal/lsp/testdata/missingfunction/channels.go.golden b/internal/lsp/testdata/missingfunction/channels.go.golden deleted file mode 100644 index f5078fed1..000000000 --- a/internal/lsp/testdata/missingfunction/channels.go.golden +++ /dev/null @@ -1,15 +0,0 @@ --- suggestedfix_channels_4_2 -- -package missingfunction - -func channels(s string) { - undefinedChannels(c()) //@suggestedfix("undefinedChannels", "quickfix") -} - -func undefinedChannels(ch1 <-chan string, ch2 chan string) { - panic("unimplemented") -} - -func c() (<-chan string, chan string) { - return make(<-chan string), make(chan string) -} - diff --git a/internal/lsp/testdata/missingfunction/consecutive_params.go b/internal/lsp/testdata/missingfunction/consecutive_params.go deleted file mode 100644 index d2ec3be32..000000000 --- a/internal/lsp/testdata/missingfunction/consecutive_params.go +++ /dev/null @@ -1,6 +0,0 @@ -package missingfunction - -func consecutiveParams() { - var s string - undefinedConsecutiveParams(s, s) //@suggestedfix("undefinedConsecutiveParams", "quickfix") -} diff --git a/internal/lsp/testdata/missingfunction/consecutive_params.go.golden b/internal/lsp/testdata/missingfunction/consecutive_params.go.golden deleted file mode 100644 index 14a766496..000000000 --- a/internal/lsp/testdata/missingfunction/consecutive_params.go.golden +++ /dev/null @@ -1,12 +0,0 @@ --- suggestedfix_consecutive_params_5_2 -- -package missingfunction - -func consecutiveParams() { - var s string - undefinedConsecutiveParams(s, s) //@suggestedfix("undefinedConsecutiveParams", "quickfix") -} - -func undefinedConsecutiveParams(s1, s2 string) { - panic("unimplemented") -} - diff --git a/internal/lsp/testdata/missingfunction/error_param.go b/internal/lsp/testdata/missingfunction/error_param.go deleted file mode 100644 index 9fd943ffb..000000000 --- a/internal/lsp/testdata/missingfunction/error_param.go +++ /dev/null @@ -1,6 +0,0 @@ -package missingfunction - -func errorParam() { - var err error - undefinedErrorParam(err) //@suggestedfix("undefinedErrorParam", "quickfix") -} diff --git a/internal/lsp/testdata/missingfunction/error_param.go.golden b/internal/lsp/testdata/missingfunction/error_param.go.golden deleted file mode 100644 index 2e1271181..000000000 --- a/internal/lsp/testdata/missingfunction/error_param.go.golden +++ /dev/null @@ -1,12 +0,0 @@ --- suggestedfix_error_param_5_2 -- -package missingfunction - -func errorParam() { - var err error - undefinedErrorParam(err) //@suggestedfix("undefinedErrorParam", "quickfix") -} - -func undefinedErrorParam(err error) { - panic("unimplemented") -} - diff --git a/internal/lsp/testdata/missingfunction/literals.go b/internal/lsp/testdata/missingfunction/literals.go deleted file mode 100644 index e276eae79..000000000 --- a/internal/lsp/testdata/missingfunction/literals.go +++ /dev/null @@ -1,7 +0,0 @@ -package missingfunction - -type T struct{} - -func literals() { - undefinedLiterals("hey compiler", T{}, &T{}) //@suggestedfix("undefinedLiterals", "quickfix") -} diff --git a/internal/lsp/testdata/missingfunction/literals.go.golden b/internal/lsp/testdata/missingfunction/literals.go.golden deleted file mode 100644 index 04782b9bf..000000000 --- a/internal/lsp/testdata/missingfunction/literals.go.golden +++ /dev/null @@ -1,29 +0,0 @@ --- suggestedfix_literals_10_2 -- -// Copyright 2021 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package missingfunction - -type T struct{} - -func literals() { - undefinedLiterals("hey compiler", T{}, &T{}) //@suggestedfix("undefinedLiterals", "quickfix") -} - -func undefinedLiterals(s string, t1 T, t2 *T) { - panic("implement me!") -} --- suggestedfix_literals_6_2 -- -package missingfunction - -type T struct{} - -func literals() { - undefinedLiterals("hey compiler", T{}, &T{}) //@suggestedfix("undefinedLiterals", "quickfix") -} - -func undefinedLiterals(s string, t1 T, t2 *T) { - panic("unimplemented") -} - diff --git a/internal/lsp/testdata/missingfunction/operation.go b/internal/lsp/testdata/missingfunction/operation.go deleted file mode 100644 index 0408219fe..000000000 --- a/internal/lsp/testdata/missingfunction/operation.go +++ /dev/null @@ -1,7 +0,0 @@ -package missingfunction - -import "time" - -func operation() { - undefinedOperation(10 * time.Second) //@suggestedfix("undefinedOperation", "quickfix") -} diff --git a/internal/lsp/testdata/missingfunction/operation.go.golden b/internal/lsp/testdata/missingfunction/operation.go.golden deleted file mode 100644 index 5e35f3005..000000000 --- a/internal/lsp/testdata/missingfunction/operation.go.golden +++ /dev/null @@ -1,29 +0,0 @@ --- suggestedfix_operation_10_2 -- -// Copyright 2021 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package missingfunction - -import "time" - -func operation() { - undefinedOperation(10 * time.Second) //@suggestedfix("undefinedOperation", "quickfix") -} - -func undefinedOperation(duration time.Duration) { - panic("implement me!") -} --- suggestedfix_operation_6_2 -- -package missingfunction - -import "time" - -func operation() { - undefinedOperation(10 * time.Second) //@suggestedfix("undefinedOperation", "quickfix") -} - -func undefinedOperation(duration time.Duration) { - panic("unimplemented") -} - diff --git a/internal/lsp/testdata/missingfunction/selector.go b/internal/lsp/testdata/missingfunction/selector.go deleted file mode 100644 index afd1ab61f..000000000 --- a/internal/lsp/testdata/missingfunction/selector.go +++ /dev/null @@ -1,6 +0,0 @@ -package missingfunction - -func selector() { - m := map[int]bool{} - undefinedSelector(m[1]) //@suggestedfix("undefinedSelector", "quickfix") -} diff --git a/internal/lsp/testdata/missingfunction/selector.go.golden b/internal/lsp/testdata/missingfunction/selector.go.golden deleted file mode 100644 index c48691c4e..000000000 --- a/internal/lsp/testdata/missingfunction/selector.go.golden +++ /dev/null @@ -1,12 +0,0 @@ --- suggestedfix_selector_5_2 -- -package missingfunction - -func selector() { - m := map[int]bool{} - undefinedSelector(m[1]) //@suggestedfix("undefinedSelector", "quickfix") -} - -func undefinedSelector(b bool) { - panic("unimplemented") -} - diff --git a/internal/lsp/testdata/missingfunction/slice.go b/internal/lsp/testdata/missingfunction/slice.go deleted file mode 100644 index 4a562a2e7..000000000 --- a/internal/lsp/testdata/missingfunction/slice.go +++ /dev/null @@ -1,5 +0,0 @@ -package missingfunction - -func slice() { - undefinedSlice([]int{1, 2}) //@suggestedfix("undefinedSlice", "quickfix") -} diff --git a/internal/lsp/testdata/missingfunction/slice.go.golden b/internal/lsp/testdata/missingfunction/slice.go.golden deleted file mode 100644 index 0ccb8611b..000000000 --- a/internal/lsp/testdata/missingfunction/slice.go.golden +++ /dev/null @@ -1,11 +0,0 @@ --- suggestedfix_slice_4_2 -- -package missingfunction - -func slice() { - undefinedSlice([]int{1, 2}) //@suggestedfix("undefinedSlice", "quickfix") -} - -func undefinedSlice(i []int) { - panic("unimplemented") -} - diff --git a/internal/lsp/testdata/missingfunction/tuple.go b/internal/lsp/testdata/missingfunction/tuple.go deleted file mode 100644 index 1c4782c15..000000000 --- a/internal/lsp/testdata/missingfunction/tuple.go +++ /dev/null @@ -1,9 +0,0 @@ -package missingfunction - -func tuple() { - undefinedTuple(b()) //@suggestedfix("undefinedTuple", "quickfix") -} - -func b() (string, error) { - return "", nil -} diff --git a/internal/lsp/testdata/missingfunction/tuple.go.golden b/internal/lsp/testdata/missingfunction/tuple.go.golden deleted file mode 100644 index 1e12bb708..000000000 --- a/internal/lsp/testdata/missingfunction/tuple.go.golden +++ /dev/null @@ -1,15 +0,0 @@ --- suggestedfix_tuple_4_2 -- -package missingfunction - -func tuple() { - undefinedTuple(b()) //@suggestedfix("undefinedTuple", "quickfix") -} - -func undefinedTuple(s string, err error) { - panic("unimplemented") -} - -func b() (string, error) { - return "", nil -} - diff --git a/internal/lsp/testdata/missingfunction/unique_params.go b/internal/lsp/testdata/missingfunction/unique_params.go deleted file mode 100644 index ffaba3f9c..000000000 --- a/internal/lsp/testdata/missingfunction/unique_params.go +++ /dev/null @@ -1,7 +0,0 @@ -package missingfunction - -func uniqueArguments() { - var s string - var i int - undefinedUniqueArguments(s, i, s) //@suggestedfix("undefinedUniqueArguments", "quickfix") -} diff --git a/internal/lsp/testdata/missingfunction/unique_params.go.golden b/internal/lsp/testdata/missingfunction/unique_params.go.golden deleted file mode 100644 index 74fb91a8e..000000000 --- a/internal/lsp/testdata/missingfunction/unique_params.go.golden +++ /dev/null @@ -1,30 +0,0 @@ --- suggestedfix_unique_params_10_2 -- -// Copyright 2021 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package missingfunction - -func uniqueArguments() { - var s string - var i int - undefinedUniqueArguments(s, i, s) //@suggestedfix("undefinedUniqueArguments", "quickfix") -} - -func undefinedUniqueArguments(s1 string, i int, s2 string) { - panic("implement me!") -} - --- suggestedfix_unique_params_6_2 -- -package missingfunction - -func uniqueArguments() { - var s string - var i int - undefinedUniqueArguments(s, i, s) //@suggestedfix("undefinedUniqueArguments", "quickfix") -} - -func undefinedUniqueArguments(s1 string, i int, s2 string) { - panic("unimplemented") -} - diff --git a/internal/lsp/testdata/multireturn/multi_return.go.in b/internal/lsp/testdata/multireturn/multi_return.go.in deleted file mode 100644 index c302f3815..000000000 --- a/internal/lsp/testdata/multireturn/multi_return.go.in +++ /dev/null @@ -1,48 +0,0 @@ -package multireturn - -func f0() {} //@item(multiF0, "f0", "func()", "func") - -func f1(int) int { return 0 } //@item(multiF1, "f1", "func(int) int", "func") - -func f2(int, int) (int, int) { return 0, 0 } //@item(multiF2, "f2", "func(int, int) (int, int)", "func") - -func f2Str(string, string) (string, string) { return "", "" } //@item(multiF2Str, "f2Str", "func(string, string) (string, string)", "func") - -func f3(int, int, int) (int, int, int) { return 0, 0, 0 } //@item(multiF3, "f3", "func(int, int, int) (int, int, int)", "func") - -func _() { - _ := f //@rank(" //", multiF1, multiF2) - - _, _ := f //@rank(" //", multiF2, multiF0),rank(" //", multiF1, multiF0) - - _, _ := _, f //@rank(" //", multiF1, multiF2),rank(" //", multiF1, multiF0) - - _, _ := f, abc //@rank(", abc", multiF1, multiF2) - - f1() //@rank(")", multiF1, multiF0) - f1(f) //@rank(")", multiF1, multiF2) - f2(f) //@rank(")", multiF2, multiF3),rank(")", multiF1, multiF3) - f2(1, f) //@rank(")", multiF1, multiF2),rank(")", multiF1, multiF0) - f2(1, ) //@rank(")", multiF1, multiF2),rank(")", multiF1, multiF0) - f2Str() //@rank(")", multiF2Str, multiF2) - - var i int - i, _ := f //@rank(" //", multiF2, multiF2Str) - - var s string - _, s := f //@rank(" //", multiF2Str, multiF2) - - banana, s = f //@rank(" //", multiF2, multiF3) - - var variadic func(int, ...int) - variadic() //@rank(")", multiF1, multiF0),rank(")", multiF2, multiF0),rank(")", multiF3, multiF0) -} - -func _() { - var baz func(...interface{}) - - var otterNap func() (int, int) //@item(multiTwo, "otterNap", "func() (int, int)", "var") - var one int //@item(multiOne, "one", "int", "var") - - baz(on) //@rank(")", multiOne, multiTwo) -} diff --git a/internal/lsp/testdata/nested_complit/nested_complit.go.in b/internal/lsp/testdata/nested_complit/nested_complit.go.in deleted file mode 100644 index 1dddd5b1b..000000000 --- a/internal/lsp/testdata/nested_complit/nested_complit.go.in +++ /dev/null @@ -1,14 +0,0 @@ -package nested_complit - -type ncFoo struct {} //@item(structNCFoo, "ncFoo", "struct{...}", "struct") - -type ncBar struct { //@item(structNCBar, "ncBar", "struct{...}", "struct") - baz []ncFoo -} - -func _() { - []ncFoo{} //@item(litNCFoo, "[]ncFoo{}", "", "var") - _ := ncBar{ - baz: [] //@complete(" //", structNCFoo, structNCBar) - } -} diff --git a/internal/lsp/testdata/nodisk/empty b/internal/lsp/testdata/nodisk/empty deleted file mode 100644 index 0c10a42f9..000000000 --- a/internal/lsp/testdata/nodisk/empty +++ /dev/null @@ -1 +0,0 @@ -an empty file so that this directory exists
\ No newline at end of file diff --git a/internal/lsp/testdata/nodisk/nodisk.overlay.go b/internal/lsp/testdata/nodisk/nodisk.overlay.go deleted file mode 100644 index f9194be56..000000000 --- a/internal/lsp/testdata/nodisk/nodisk.overlay.go +++ /dev/null @@ -1,9 +0,0 @@ -package nodisk - -import ( - "golang.org/x/tools/internal/lsp/foo" -) - -func _() { - foo.Foo() //@complete("F", Foo, IntFoo, StructFoo) -} diff --git a/internal/lsp/testdata/noparse/noparse.go.in b/internal/lsp/testdata/noparse/noparse.go.in deleted file mode 100644 index 7dc23e025..000000000 --- a/internal/lsp/testdata/noparse/noparse.go.in +++ /dev/null @@ -1,11 +0,0 @@ -package noparse - -func bye(x int) { - hi() -} - -func stuff() { - x := 5 -} - -func .() {} //@diag(".", "syntax", "expected 'IDENT', found '.'", "error") diff --git a/internal/lsp/testdata/noparse_format/noparse_format.go.golden b/internal/lsp/testdata/noparse_format/noparse_format.go.golden deleted file mode 100644 index 0060c5c92..000000000 --- a/internal/lsp/testdata/noparse_format/noparse_format.go.golden +++ /dev/null @@ -1,2 +0,0 @@ --- gofmt -- - diff --git a/internal/lsp/testdata/noparse_format/noparse_format.go.in b/internal/lsp/testdata/noparse_format/noparse_format.go.in deleted file mode 100644 index 4fc3824d9..000000000 --- a/internal/lsp/testdata/noparse_format/noparse_format.go.in +++ /dev/null @@ -1,9 +0,0 @@ -// +build go1.11 - -package noparse_format //@format("package") - -func what() { - var b int - if { hi() //@diag("{", "syntax", "missing condition in if statement", "error") - } -}
\ No newline at end of file diff --git a/internal/lsp/testdata/noparse_format/parse_format.go.golden b/internal/lsp/testdata/noparse_format/parse_format.go.golden deleted file mode 100644 index 667c90b22..000000000 --- a/internal/lsp/testdata/noparse_format/parse_format.go.golden +++ /dev/null @@ -1,7 +0,0 @@ --- gofmt -- -package noparse_format //@format("package") - -func _() { - f() -} - diff --git a/internal/lsp/testdata/noparse_format/parse_format.go.in b/internal/lsp/testdata/noparse_format/parse_format.go.in deleted file mode 100644 index 4b98cf8d0..000000000 --- a/internal/lsp/testdata/noparse_format/parse_format.go.in +++ /dev/null @@ -1,5 +0,0 @@ -package noparse_format //@format("package") - -func _() { -f() -}
\ No newline at end of file diff --git a/internal/lsp/testdata/printf/printf.go b/internal/lsp/testdata/printf/printf.go deleted file mode 100644 index 6e56549c1..000000000 --- a/internal/lsp/testdata/printf/printf.go +++ /dev/null @@ -1,33 +0,0 @@ -package printf - -import "fmt" - -func myPrintf(string, ...interface{}) {} - -func _() { - var ( - aInt int //@item(printfInt, "aInt", "int", "var") - aFloat float64 //@item(printfFloat, "aFloat", "float64", "var") - aString string //@item(printfString, "aString", "string", "var") - aBytes []byte //@item(printfBytes, "aBytes", "[]byte", "var") - aStringer fmt.Stringer //@item(printfStringer, "aStringer", "fmt.Stringer", "var") - aError error //@item(printfError, "aError", "error", "var") - aBool bool //@item(printfBool, "aBool", "bool", "var") - ) - - myPrintf("%d", a) //@rank(")", printfInt, printfFloat) - myPrintf("%s", a) //@rank(")", printfString, printfInt),rank(")", printfBytes, printfInt),rank(")", printfStringer, printfInt),rank(")", printfError, printfInt) - myPrintf("%w", a) //@rank(")", printfError, printfInt) - myPrintf("%x %[1]b", a) //@rank(")", printfInt, printfString) - - fmt.Printf("%t", a) //@rank(")", printfBool, printfInt) - - fmt.Fprintf(nil, "%f", a) //@rank(")", printfFloat, printfInt) - - fmt.Sprintf("%[2]q %[1]*.[3]*[4]f", - a, //@rank(",", printfInt, printfFloat) - a, //@rank(",", printfString, printfFloat) - a, //@rank(",", printfInt, printfFloat) - a, //@rank(",", printfFloat, printfInt) - ) -} diff --git a/internal/lsp/testdata/rank/assign_rank.go.in b/internal/lsp/testdata/rank/assign_rank.go.in deleted file mode 100644 index 5c51910d4..000000000 --- a/internal/lsp/testdata/rank/assign_rank.go.in +++ /dev/null @@ -1,19 +0,0 @@ -package rank - -var ( - apple int = 3 //@item(apple, "apple", "int", "var") - pear string = "hello" //@item(pear, "pear", "string", "var") -) - -func _() { - orange := 1 //@item(orange, "orange", "int", "var") - grape := "hello" //@item(grape, "grape", "string", "var") - orange, grape = 2, "hello" //@complete(" \"", grape, pear, orange, apple) -} - -func _() { - var pineapple int //@item(pineapple, "pineapple", "int", "var") - pineapple = 1 //@complete(" 1", pineapple, apple, pear) - - y := //@complete(" /", pineapple, apple, pear) -} diff --git a/internal/lsp/testdata/rank/binexpr_rank.go.in b/internal/lsp/testdata/rank/binexpr_rank.go.in deleted file mode 100644 index 60b2cc1bc..000000000 --- a/internal/lsp/testdata/rank/binexpr_rank.go.in +++ /dev/null @@ -1,8 +0,0 @@ -package rank - -func _() { - _ = 5 + ; //@complete(" ;", apple, pear) - y := + 5; //@complete(" +", apple, pear) - - if 6 == {} //@complete(" {", apple, pear) -} diff --git a/internal/lsp/testdata/rank/boolexpr_rank.go b/internal/lsp/testdata/rank/boolexpr_rank.go deleted file mode 100644 index fe512eee1..000000000 --- a/internal/lsp/testdata/rank/boolexpr_rank.go +++ /dev/null @@ -1,11 +0,0 @@ -package rank - -func _() { - someRandomBoolFunc := func() bool { //@item(boolExprFunc, "someRandomBoolFunc", "func() bool", "var") - return true - } - - var foo, bar int //@item(boolExprBar, "bar", "int", "var") - if foo == 123 && b { //@rank(" {", boolExprBar, boolExprFunc) - } -} diff --git a/internal/lsp/testdata/rank/convert_rank.go.in b/internal/lsp/testdata/rank/convert_rank.go.in deleted file mode 100644 index c43004833..000000000 --- a/internal/lsp/testdata/rank/convert_rank.go.in +++ /dev/null @@ -1,54 +0,0 @@ -package rank - -import "time" - -func _() { - type strList []string - wantsStrList := func(strList) {} - - var ( - convA string //@item(convertA, "convA", "string", "var") - convB []string //@item(convertB, "convB", "[]string", "var") - ) - wantsStrList(strList(conv)) //@complete("))", convertB, convertA) -} - -func _() { - type myInt int - - const ( - convC = "hi" //@item(convertC, "convC", "string", "const") - convD = 123 //@item(convertD, "convD", "int", "const") - convE int = 123 //@item(convertE, "convE", "int", "const") - convF string = "there" //@item(convertF, "convF", "string", "const") - convG myInt = 123 //@item(convertG, "convG", "myInt", "const") - ) - - var foo int - foo = conv //@rank(" //", convertE, convertD) - - var mi myInt - mi = conv //@rank(" //", convertG, convertD, convertE) - mi + conv //@rank(" //", convertG, convertD, convertE) - - 1 + conv //@rank(" //", convertD, convertC),rank(" //", convertE, convertC),rank(" //", convertG, convertC) - - type myString string - var ms myString - ms = conv //@rank(" //", convertC, convertF) - - type myUint uint32 - var mu myUint - mu = conv //@rank(" //", convertD, convertE) - - // don't downrank constants when assigning to interface{} - var _ interface{} = c //@rank(" //", convertD, complex) - - var _ time.Duration = conv //@rank(" //", convertD, convertE),snippet(" //", convertE, "time.Duration(convE)", "time.Duration(convE)") - - var convP myInt //@item(convertP, "convP", "myInt", "var") - var _ *int = conv //@snippet(" //", convertP, "(*int)(&convP)", "(*int)(&convP)") - - var ff float64 //@item(convertFloat, "ff", "float64", "var") - f == convD //@snippet(" =", convertFloat, "ff", "ff") -} diff --git a/internal/lsp/testdata/rank/struct/struct_rank.go b/internal/lsp/testdata/rank/struct/struct_rank.go deleted file mode 100644 index e0bdd38a8..000000000 --- a/internal/lsp/testdata/rank/struct/struct_rank.go +++ /dev/null @@ -1,11 +0,0 @@ -package struct_rank - -type foo struct { - c int //@item(c_rank, "c", "int", "field") - b int //@item(b_rank, "b", "int", "field") - a int //@item(a_rank, "a", "int", "field") -} - -func f() { - foo := foo{} //@rank("}", c_rank, b_rank, a_rank) -} diff --git a/internal/lsp/testdata/rank/switch_rank.go.in b/internal/lsp/testdata/rank/switch_rank.go.in deleted file mode 100644 index b828528da..000000000 --- a/internal/lsp/testdata/rank/switch_rank.go.in +++ /dev/null @@ -1,29 +0,0 @@ -package rank - -import "time" - -func _() { - switch pear { - case _: //@rank("_", pear, apple) - } - - time.Monday //@item(timeMonday, "time.Monday", "time.Weekday", "const"),item(monday ,"Monday", "time.Weekday", "const") - time.Friday //@item(timeFriday, "time.Friday", "time.Weekday", "const"),item(friday ,"Friday", "time.Weekday", "const") - - now := time.Now() - now.Weekday //@item(nowWeekday, "now.Weekday", "func() time.Weekday", "method") - - then := time.Now() - then.Weekday //@item(thenWeekday, "then.Weekday", "func() time.Weekday", "method") - - switch time.Weekday(0) { - case time.Monday, time.Tuesday: - case time.Wednesday, time.Thursday: - case time.Saturday, time.Sunday: - case t: //@rank(":", timeFriday, timeMonday) - case time.: //@rank(":", friday, monday) - - case now.Weekday(): - case week: //@rank(":", thenWeekday, nowWeekday) - } -} diff --git a/internal/lsp/testdata/rank/type_assert_rank.go.in b/internal/lsp/testdata/rank/type_assert_rank.go.in deleted file mode 100644 index 416541cdd..000000000 --- a/internal/lsp/testdata/rank/type_assert_rank.go.in +++ /dev/null @@ -1,8 +0,0 @@ -package rank - -func _() { - type flower int //@item(flower, "flower", "int", "type") - var fig string //@item(fig, "fig", "string", "var") - - _ = interface{}(nil).(f) //@complete(") //", flower) -} diff --git a/internal/lsp/testdata/rank/type_switch_rank.go.in b/internal/lsp/testdata/rank/type_switch_rank.go.in deleted file mode 100644 index 1ed12b7c1..000000000 --- a/internal/lsp/testdata/rank/type_switch_rank.go.in +++ /dev/null @@ -1,31 +0,0 @@ -package rank - -import ( - "fmt" - "go/ast" -) - -func _() { - type basket int //@item(basket, "basket", "int", "type") - var banana string //@item(banana, "banana", "string", "var") - - switch interface{}(pear).(type) { - case b: //@complete(":", basket) - b //@complete(" //", banana, basket) - } - - Ident //@item(astIdent, "Ident", "struct{...}", "struct") - IfStmt //@item(astIfStmt, "IfStmt", "struct{...}", "struct") - - switch ast.Node(nil).(type) { - case *ast.Ident: - case *ast.I: //@rank(":", astIfStmt, astIdent) - } - - Stringer //@item(fmtStringer, "Stringer", "interface{...}", "interface") - GoStringer //@item(fmtGoStringer, "GoStringer", "interface{...}", "interface") - - switch interface{}(nil).(type) { - case fmt.Stringer: //@rank(":", fmtStringer, fmtGoStringer) - } -} diff --git a/internal/lsp/testdata/references/another/another.go b/internal/lsp/testdata/references/another/another.go deleted file mode 100644 index 47bda1e4a..000000000 --- a/internal/lsp/testdata/references/another/another.go +++ /dev/null @@ -1,13 +0,0 @@ -// Package another has another type. -package another - -import ( - other "golang.org/x/tools/internal/lsp/references/other" -) - -func _() { - xes := other.GetXes() - for _, x := range xes { //@mark(defX, "x") - _ = x.Y //@mark(useX, "x"),mark(anotherXY, "Y"),refs("Y", typeXY, anotherXY, GetXesY),refs(".", defX, useX),refs("x", defX, useX) - } -} diff --git a/internal/lsp/testdata/references/interfaces/interfaces.go b/internal/lsp/testdata/references/interfaces/interfaces.go deleted file mode 100644 index 6661dcc5d..000000000 --- a/internal/lsp/testdata/references/interfaces/interfaces.go +++ /dev/null @@ -1,34 +0,0 @@ -package interfaces - -type first interface { - common() //@mark(firCommon, "common"),refs("common", firCommon, xCommon, zCommon) - firstMethod() //@mark(firMethod, "firstMethod"),refs("firstMethod", firMethod, xfMethod, zfMethod) -} - -type second interface { - common() //@mark(secCommon, "common"),refs("common", secCommon, yCommon, zCommon) - secondMethod() //@mark(secMethod, "secondMethod"),refs("secondMethod", secMethod, ysMethod, zsMethod) -} - -type s struct {} - -func (*s) common() {} //@mark(sCommon, "common"),refs("common", sCommon, xCommon, yCommon, zCommon) - -func (*s) firstMethod() {} //@mark(sfMethod, "firstMethod"),refs("firstMethod", sfMethod, xfMethod, zfMethod) - -func (*s) secondMethod() {} //@mark(ssMethod, "secondMethod"),refs("secondMethod", ssMethod, ysMethod, zsMethod) - -func main() { - var x first = &s{} - var y second = &s{} - - x.common() //@mark(xCommon, "common"),refs("common", firCommon, xCommon, zCommon) - x.firstMethod() //@mark(xfMethod, "firstMethod"),refs("firstMethod", firMethod, xfMethod, zfMethod) - y.common() //@mark(yCommon, "common"),refs("common", secCommon, yCommon, zCommon) - y.secondMethod() //@mark(ysMethod, "secondMethod"),refs("secondMethod", secMethod, ysMethod, zsMethod) - - var z *s = &s{} - z.firstMethod() //@mark(zfMethod, "firstMethod"),refs("firstMethod", sfMethod, xfMethod, zfMethod) - z.secondMethod() //@mark(zsMethod, "secondMethod"),refs("secondMethod", ssMethod, ysMethod, zsMethod) - z.common() //@mark(zCommon, "common"),refs("common", sCommon, xCommon, yCommon, zCommon) -} diff --git a/internal/lsp/testdata/references/other/other.go b/internal/lsp/testdata/references/other/other.go deleted file mode 100644 index de35cc81a..000000000 --- a/internal/lsp/testdata/references/other/other.go +++ /dev/null @@ -1,19 +0,0 @@ -package other - -import ( - references "golang.org/x/tools/internal/lsp/references" -) - -func GetXes() []references.X { - return []references.X{ - { - Y: 1, //@mark(GetXesY, "Y"),refs("Y", typeXY, GetXesY, anotherXY) - }, - } -} - -func _() { - references.Q = "hello" //@mark(assignExpQ, "Q") - bob := func(_ string) {} - bob(references.Q) //@mark(bobExpQ, "Q") -} diff --git a/internal/lsp/testdata/references/refs.go b/internal/lsp/testdata/references/refs.go deleted file mode 100644 index 933a36f54..000000000 --- a/internal/lsp/testdata/references/refs.go +++ /dev/null @@ -1,38 +0,0 @@ -// Package refs is a package used to test find references. -package refs - -type i int //@mark(typeI, "i"),refs("i", typeI, argI, returnI, embeddedI) - -type X struct { - Y int //@mark(typeXY, "Y") -} - -func _(_ i) []bool { //@mark(argI, "i") - return nil -} - -func _(_ []byte) i { //@mark(returnI, "i") - return 0 -} - -var q string //@mark(declQ, "q"),refs("q", declQ, assignQ, bobQ) - -var Q string //@mark(declExpQ, "Q"),refs("Q", declExpQ, assignExpQ, bobExpQ) - -func _() { - q = "hello" //@mark(assignQ, "q") - bob := func(_ string) {} - bob(q) //@mark(bobQ, "q") -} - -type e struct { - i //@mark(embeddedI, "i"),refs("i", embeddedI, embeddedIUse) -} - -func _() { - _ = e{}.i //@mark(embeddedIUse, "i") -} - -const ( - foo = iota //@refs("iota") -) diff --git a/internal/lsp/testdata/references/refs_test.go b/internal/lsp/testdata/references/refs_test.go deleted file mode 100644 index 08c0db1f0..000000000 --- a/internal/lsp/testdata/references/refs_test.go +++ /dev/null @@ -1,10 +0,0 @@ -package references - -import ( - "testing" -) - -// This test exists to bring the test package into existence. - -func TestReferences(t *testing.T) { -} diff --git a/internal/lsp/testdata/rename/a/random.go.golden b/internal/lsp/testdata/rename/a/random.go.golden deleted file mode 100644 index 7459863ec..000000000 --- a/internal/lsp/testdata/rename/a/random.go.golden +++ /dev/null @@ -1,616 +0,0 @@ --- GetSum-rename -- -package a - -import ( - lg "log" - "fmt" //@rename("fmt", "fmty") - f2 "fmt" //@rename("f2", "f2name"),rename("fmt","f2y") -) - -func Random() int { - y := 6 + 7 - return y -} - -func Random2(y int) int { //@rename("y", "z") - return y -} - -type Pos struct { - x, y int -} - -func (p *Pos) GetSum() int { - return p.x + p.y //@rename("x", "myX") -} - -func _() { - var p Pos //@rename("p", "pos") - _ = p.GetSum() //@rename("Sum", "GetSum") -} - -func sw() { - var x interface{} - - switch y := x.(type) { //@rename("y", "y0") - case int: - fmt.Printf("%d", y) //@rename("y", "y1"),rename("fmt", "format") - case string: - lg.Printf("%s", y) //@rename("y", "y2"),rename("lg","log") - default: - f2.Printf("%v", y) //@rename("y", "y3"),rename("f2","fmt2") - } -} - --- f2name-rename -- -package a - -import ( - lg "log" - "fmt" //@rename("fmt", "fmty") - f2name "fmt" //@rename("f2", "f2name"),rename("fmt","f2y") -) - -func Random() int { - y := 6 + 7 - return y -} - -func Random2(y int) int { //@rename("y", "z") - return y -} - -type Pos struct { - x, y int -} - -func (p *Pos) Sum() int { - return p.x + p.y //@rename("x", "myX") -} - -func _() { - var p Pos //@rename("p", "pos") - _ = p.Sum() //@rename("Sum", "GetSum") -} - -func sw() { - var x interface{} - - switch y := x.(type) { //@rename("y", "y0") - case int: - fmt.Printf("%d", y) //@rename("y", "y1"),rename("fmt", "format") - case string: - lg.Printf("%s", y) //@rename("y", "y2"),rename("lg","log") - default: - f2name.Printf("%v", y) //@rename("y", "y3"),rename("f2","fmt2") - } -} - --- f2y-rename -- -package a - -import ( - lg "log" - "fmt" //@rename("fmt", "fmty") - f2y "fmt" //@rename("f2", "f2name"),rename("fmt","f2y") -) - -func Random() int { - y := 6 + 7 - return y -} - -func Random2(y int) int { //@rename("y", "z") - return y -} - -type Pos struct { - x, y int -} - -func (p *Pos) Sum() int { - return p.x + p.y //@rename("x", "myX") -} - -func _() { - var p Pos //@rename("p", "pos") - _ = p.Sum() //@rename("Sum", "GetSum") -} - -func sw() { - var x interface{} - - switch y := x.(type) { //@rename("y", "y0") - case int: - fmt.Printf("%d", y) //@rename("y", "y1"),rename("fmt", "format") - case string: - lg.Printf("%s", y) //@rename("y", "y2"),rename("lg","log") - default: - f2y.Printf("%v", y) //@rename("y", "y3"),rename("f2","fmt2") - } -} - --- fmt2-rename -- -package a - -import ( - lg "log" - "fmt" //@rename("fmt", "fmty") - fmt2 "fmt" //@rename("f2", "f2name"),rename("fmt","f2y") -) - -func Random() int { - y := 6 + 7 - return y -} - -func Random2(y int) int { //@rename("y", "z") - return y -} - -type Pos struct { - x, y int -} - -func (p *Pos) Sum() int { - return p.x + p.y //@rename("x", "myX") -} - -func _() { - var p Pos //@rename("p", "pos") - _ = p.Sum() //@rename("Sum", "GetSum") -} - -func sw() { - var x interface{} - - switch y := x.(type) { //@rename("y", "y0") - case int: - fmt.Printf("%d", y) //@rename("y", "y1"),rename("fmt", "format") - case string: - lg.Printf("%s", y) //@rename("y", "y2"),rename("lg","log") - default: - fmt2.Printf("%v", y) //@rename("y", "y3"),rename("f2","fmt2") - } -} - --- fmty-rename -- -package a - -import ( - lg "log" - fmty "fmt" //@rename("fmt", "fmty") - f2 "fmt" //@rename("f2", "f2name"),rename("fmt","f2y") -) - -func Random() int { - y := 6 + 7 - return y -} - -func Random2(y int) int { //@rename("y", "z") - return y -} - -type Pos struct { - x, y int -} - -func (p *Pos) Sum() int { - return p.x + p.y //@rename("x", "myX") -} - -func _() { - var p Pos //@rename("p", "pos") - _ = p.Sum() //@rename("Sum", "GetSum") -} - -func sw() { - var x interface{} - - switch y := x.(type) { //@rename("y", "y0") - case int: - fmty.Printf("%d", y) //@rename("y", "y1"),rename("fmt", "format") - case string: - lg.Printf("%s", y) //@rename("y", "y2"),rename("lg","log") - default: - f2.Printf("%v", y) //@rename("y", "y3"),rename("f2","fmt2") - } -} - --- format-rename -- -package a - -import ( - lg "log" - format "fmt" //@rename("fmt", "fmty") - f2 "fmt" //@rename("f2", "f2name"),rename("fmt","f2y") -) - -func Random() int { - y := 6 + 7 - return y -} - -func Random2(y int) int { //@rename("y", "z") - return y -} - -type Pos struct { - x, y int -} - -func (p *Pos) Sum() int { - return p.x + p.y //@rename("x", "myX") -} - -func _() { - var p Pos //@rename("p", "pos") - _ = p.Sum() //@rename("Sum", "GetSum") -} - -func sw() { - var x interface{} - - switch y := x.(type) { //@rename("y", "y0") - case int: - format.Printf("%d", y) //@rename("y", "y1"),rename("fmt", "format") - case string: - lg.Printf("%s", y) //@rename("y", "y2"),rename("lg","log") - default: - f2.Printf("%v", y) //@rename("y", "y3"),rename("f2","fmt2") - } -} - --- log-rename -- -package a - -import ( - "log" - "fmt" //@rename("fmt", "fmty") - f2 "fmt" //@rename("f2", "f2name"),rename("fmt","f2y") -) - -func Random() int { - y := 6 + 7 - return y -} - -func Random2(y int) int { //@rename("y", "z") - return y -} - -type Pos struct { - x, y int -} - -func (p *Pos) Sum() int { - return p.x + p.y //@rename("x", "myX") -} - -func _() { - var p Pos //@rename("p", "pos") - _ = p.Sum() //@rename("Sum", "GetSum") -} - -func sw() { - var x interface{} - - switch y := x.(type) { //@rename("y", "y0") - case int: - fmt.Printf("%d", y) //@rename("y", "y1"),rename("fmt", "format") - case string: - log.Printf("%s", y) //@rename("y", "y2"),rename("lg","log") - default: - f2.Printf("%v", y) //@rename("y", "y3"),rename("f2","fmt2") - } -} - --- myX-rename -- -package a - -import ( - lg "log" - "fmt" //@rename("fmt", "fmty") - f2 "fmt" //@rename("f2", "f2name"),rename("fmt","f2y") -) - -func Random() int { - y := 6 + 7 - return y -} - -func Random2(y int) int { //@rename("y", "z") - return y -} - -type Pos struct { - myX, y int -} - -func (p *Pos) Sum() int { - return p.myX + p.y //@rename("x", "myX") -} - -func _() { - var p Pos //@rename("p", "pos") - _ = p.Sum() //@rename("Sum", "GetSum") -} - -func sw() { - var x interface{} - - switch y := x.(type) { //@rename("y", "y0") - case int: - fmt.Printf("%d", y) //@rename("y", "y1"),rename("fmt", "format") - case string: - lg.Printf("%s", y) //@rename("y", "y2"),rename("lg","log") - default: - f2.Printf("%v", y) //@rename("y", "y3"),rename("f2","fmt2") - } -} - --- pos-rename -- -package a - -import ( - lg "log" - "fmt" //@rename("fmt", "fmty") - f2 "fmt" //@rename("f2", "f2name"),rename("fmt","f2y") -) - -func Random() int { - y := 6 + 7 - return y -} - -func Random2(y int) int { //@rename("y", "z") - return y -} - -type Pos struct { - x, y int -} - -func (p *Pos) Sum() int { - return p.x + p.y //@rename("x", "myX") -} - -func _() { - var pos Pos //@rename("p", "pos") - _ = pos.Sum() //@rename("Sum", "GetSum") -} - -func sw() { - var x interface{} - - switch y := x.(type) { //@rename("y", "y0") - case int: - fmt.Printf("%d", y) //@rename("y", "y1"),rename("fmt", "format") - case string: - lg.Printf("%s", y) //@rename("y", "y2"),rename("lg","log") - default: - f2.Printf("%v", y) //@rename("y", "y3"),rename("f2","fmt2") - } -} - --- y0-rename -- -package a - -import ( - lg "log" - "fmt" //@rename("fmt", "fmty") - f2 "fmt" //@rename("f2", "f2name"),rename("fmt","f2y") -) - -func Random() int { - y := 6 + 7 - return y -} - -func Random2(y int) int { //@rename("y", "z") - return y -} - -type Pos struct { - x, y int -} - -func (p *Pos) Sum() int { - return p.x + p.y //@rename("x", "myX") -} - -func _() { - var p Pos //@rename("p", "pos") - _ = p.Sum() //@rename("Sum", "GetSum") -} - -func sw() { - var x interface{} - - switch y0 := x.(type) { //@rename("y", "y0") - case int: - fmt.Printf("%d", y0) //@rename("y", "y1"),rename("fmt", "format") - case string: - lg.Printf("%s", y0) //@rename("y", "y2"),rename("lg","log") - default: - f2.Printf("%v", y0) //@rename("y", "y3"),rename("f2","fmt2") - } -} - --- y1-rename -- -package a - -import ( - lg "log" - "fmt" //@rename("fmt", "fmty") - f2 "fmt" //@rename("f2", "f2name"),rename("fmt","f2y") -) - -func Random() int { - y := 6 + 7 - return y -} - -func Random2(y int) int { //@rename("y", "z") - return y -} - -type Pos struct { - x, y int -} - -func (p *Pos) Sum() int { - return p.x + p.y //@rename("x", "myX") -} - -func _() { - var p Pos //@rename("p", "pos") - _ = p.Sum() //@rename("Sum", "GetSum") -} - -func sw() { - var x interface{} - - switch y1 := x.(type) { //@rename("y", "y0") - case int: - fmt.Printf("%d", y1) //@rename("y", "y1"),rename("fmt", "format") - case string: - lg.Printf("%s", y1) //@rename("y", "y2"),rename("lg","log") - default: - f2.Printf("%v", y1) //@rename("y", "y3"),rename("f2","fmt2") - } -} - --- y2-rename -- -package a - -import ( - lg "log" - "fmt" //@rename("fmt", "fmty") - f2 "fmt" //@rename("f2", "f2name"),rename("fmt","f2y") -) - -func Random() int { - y := 6 + 7 - return y -} - -func Random2(y int) int { //@rename("y", "z") - return y -} - -type Pos struct { - x, y int -} - -func (p *Pos) Sum() int { - return p.x + p.y //@rename("x", "myX") -} - -func _() { - var p Pos //@rename("p", "pos") - _ = p.Sum() //@rename("Sum", "GetSum") -} - -func sw() { - var x interface{} - - switch y2 := x.(type) { //@rename("y", "y0") - case int: - fmt.Printf("%d", y2) //@rename("y", "y1"),rename("fmt", "format") - case string: - lg.Printf("%s", y2) //@rename("y", "y2"),rename("lg","log") - default: - f2.Printf("%v", y2) //@rename("y", "y3"),rename("f2","fmt2") - } -} - --- y3-rename -- -package a - -import ( - lg "log" - "fmt" //@rename("fmt", "fmty") - f2 "fmt" //@rename("f2", "f2name"),rename("fmt","f2y") -) - -func Random() int { - y := 6 + 7 - return y -} - -func Random2(y int) int { //@rename("y", "z") - return y -} - -type Pos struct { - x, y int -} - -func (p *Pos) Sum() int { - return p.x + p.y //@rename("x", "myX") -} - -func _() { - var p Pos //@rename("p", "pos") - _ = p.Sum() //@rename("Sum", "GetSum") -} - -func sw() { - var x interface{} - - switch y3 := x.(type) { //@rename("y", "y0") - case int: - fmt.Printf("%d", y3) //@rename("y", "y1"),rename("fmt", "format") - case string: - lg.Printf("%s", y3) //@rename("y", "y2"),rename("lg","log") - default: - f2.Printf("%v", y3) //@rename("y", "y3"),rename("f2","fmt2") - } -} - --- z-rename -- -package a - -import ( - lg "log" - "fmt" //@rename("fmt", "fmty") - f2 "fmt" //@rename("f2", "f2name"),rename("fmt","f2y") -) - -func Random() int { - y := 6 + 7 - return y -} - -func Random2(z int) int { //@rename("y", "z") - return z -} - -type Pos struct { - x, y int -} - -func (p *Pos) Sum() int { - return p.x + p.y //@rename("x", "myX") -} - -func _() { - var p Pos //@rename("p", "pos") - _ = p.Sum() //@rename("Sum", "GetSum") -} - -func sw() { - var x interface{} - - switch y := x.(type) { //@rename("y", "y0") - case int: - fmt.Printf("%d", y) //@rename("y", "y1"),rename("fmt", "format") - case string: - lg.Printf("%s", y) //@rename("y", "y2"),rename("lg","log") - default: - f2.Printf("%v", y) //@rename("y", "y3"),rename("f2","fmt2") - } -} - diff --git a/internal/lsp/testdata/rename/a/random.go.in b/internal/lsp/testdata/rename/a/random.go.in deleted file mode 100644 index 069db27ba..000000000 --- a/internal/lsp/testdata/rename/a/random.go.in +++ /dev/null @@ -1,42 +0,0 @@ -package a - -import ( - lg "log" - "fmt" //@rename("fmt", "fmty") - f2 "fmt" //@rename("f2", "f2name"),rename("fmt","f2y") -) - -func Random() int { - y := 6 + 7 - return y -} - -func Random2(y int) int { //@rename("y", "z") - return y -} - -type Pos struct { - x, y int -} - -func (p *Pos) Sum() int { - return p.x + p.y //@rename("x", "myX") -} - -func _() { - var p Pos //@rename("p", "pos") - _ = p.Sum() //@rename("Sum", "GetSum") -} - -func sw() { - var x interface{} - - switch y := x.(type) { //@rename("y", "y0") - case int: - fmt.Printf("%d", y) //@rename("y", "y1"),rename("fmt", "format") - case string: - lg.Printf("%s", y) //@rename("y", "y2"),rename("lg","log") - default: - f2.Printf("%v", y) //@rename("y", "y3"),rename("f2","fmt2") - } -} diff --git a/internal/lsp/testdata/rename/b/b.go b/internal/lsp/testdata/rename/b/b.go deleted file mode 100644 index 8455f035b..000000000 --- a/internal/lsp/testdata/rename/b/b.go +++ /dev/null @@ -1,20 +0,0 @@ -package b - -var c int //@rename("int", "uint") - -func _() { - a := 1 //@rename("a", "error") - a = 2 - _ = a -} - -var ( - // Hello there. - // Foo does the thing. - Foo int //@rename("Foo", "Bob") -) - -/* -Hello description -*/ -func Hello() {} //@rename("Hello", "Goodbye") diff --git a/internal/lsp/testdata/rename/b/b.go.golden b/internal/lsp/testdata/rename/b/b.go.golden deleted file mode 100644 index 9cdc5677f..000000000 --- a/internal/lsp/testdata/rename/b/b.go.golden +++ /dev/null @@ -1,78 +0,0 @@ --- Bob-rename -- -package b - -var c int //@rename("int", "uint") - -func _() { - a := 1 //@rename("a", "error") - a = 2 - _ = a -} - -var ( - // Hello there. - // Bob does the thing. - Bob int //@rename("Foo", "Bob") -) - -/* -Hello description -*/ -func Hello() {} //@rename("Hello", "Goodbye") - --- Goodbye-rename -- -b.go: -package b - -var c int //@rename("int", "uint") - -func _() { - a := 1 //@rename("a", "error") - a = 2 - _ = a -} - -var ( - // Hello there. - // Foo does the thing. - Foo int //@rename("Foo", "Bob") -) - -/* -Goodbye description -*/ -func Goodbye() {} //@rename("Hello", "Goodbye") - -c.go: -package c - -import "golang.org/x/tools/internal/lsp/rename/b" - -func _() { - b.Goodbye() //@rename("Hello", "Goodbye") -} - --- error-rename -- -package b - -var c int //@rename("int", "uint") - -func _() { - error := 1 //@rename("a", "error") - error = 2 - _ = error -} - -var ( - // Hello there. - // Foo does the thing. - Foo int //@rename("Foo", "Bob") -) - -/* -Hello description -*/ -func Hello() {} //@rename("Hello", "Goodbye") - --- uint-rename -- -"int": builtin object diff --git a/internal/lsp/testdata/rename/bad/bad.go.golden b/internal/lsp/testdata/rename/bad/bad.go.golden deleted file mode 100644 index 7f4581392..000000000 --- a/internal/lsp/testdata/rename/bad/bad.go.golden +++ /dev/null @@ -1,2 +0,0 @@ --- rFunc-rename -- -renaming "sFunc" to "rFunc" not possible because "golang.org/x/tools/internal/lsp/rename/bad" has errors diff --git a/internal/lsp/testdata/rename/bad/bad.go.in b/internal/lsp/testdata/rename/bad/bad.go.in deleted file mode 100644 index 56dbee74e..000000000 --- a/internal/lsp/testdata/rename/bad/bad.go.in +++ /dev/null @@ -1,8 +0,0 @@ -package bad - -type myStruct struct { -} - -func (s *myStruct) sFunc() bool { //@rename("sFunc", "rFunc") - return s.Bad -} diff --git a/internal/lsp/testdata/rename/bad/bad_test.go.in b/internal/lsp/testdata/rename/bad/bad_test.go.in deleted file mode 100644 index e695db14b..000000000 --- a/internal/lsp/testdata/rename/bad/bad_test.go.in +++ /dev/null @@ -1 +0,0 @@ -package bad
\ No newline at end of file diff --git a/internal/lsp/testdata/rename/c/c.go b/internal/lsp/testdata/rename/c/c.go deleted file mode 100644 index 519d2f6fc..000000000 --- a/internal/lsp/testdata/rename/c/c.go +++ /dev/null @@ -1,7 +0,0 @@ -package c - -import "golang.org/x/tools/internal/lsp/rename/b" - -func _() { - b.Hello() //@rename("Hello", "Goodbye") -} diff --git a/internal/lsp/testdata/rename/c/c.go.golden b/internal/lsp/testdata/rename/c/c.go.golden deleted file mode 100644 index 56937420c..000000000 --- a/internal/lsp/testdata/rename/c/c.go.golden +++ /dev/null @@ -1,32 +0,0 @@ --- Goodbye-rename -- -b.go: -package b - -var c int //@rename("int", "uint") - -func _() { - a := 1 //@rename("a", "error") - a = 2 - _ = a -} - -var ( - // Hello there. - // Foo does the thing. - Foo int //@rename("Foo", "Bob") -) - -/* -Goodbye description -*/ -func Goodbye() {} //@rename("Hello", "Goodbye") - -c.go: -package c - -import "golang.org/x/tools/internal/lsp/rename/b" - -func _() { - b.Goodbye() //@rename("Hello", "Goodbye") -} - diff --git a/internal/lsp/testdata/rename/c/c2.go b/internal/lsp/testdata/rename/c/c2.go deleted file mode 100644 index 4fc484a1a..000000000 --- a/internal/lsp/testdata/rename/c/c2.go +++ /dev/null @@ -1,4 +0,0 @@ -package c - -//go:embed Static/* -var Static embed.FS //@rename("Static", "static")
\ No newline at end of file diff --git a/internal/lsp/testdata/rename/c/c2.go.golden b/internal/lsp/testdata/rename/c/c2.go.golden deleted file mode 100644 index e509227a9..000000000 --- a/internal/lsp/testdata/rename/c/c2.go.golden +++ /dev/null @@ -1,5 +0,0 @@ --- static-rename -- -package c - -//go:embed Static/* -var static embed.FS //@rename("Static", "static") diff --git a/internal/lsp/testdata/rename/crosspkg/another/another.go b/internal/lsp/testdata/rename/crosspkg/another/another.go deleted file mode 100644 index 9b50af2cb..000000000 --- a/internal/lsp/testdata/rename/crosspkg/another/another.go +++ /dev/null @@ -1,13 +0,0 @@ -package another - -type ( - I interface{ F() } - C struct{ I } -) - -func (C) g() - -func _() { - var x I = C{} - x.F() //@rename("F", "G") -} diff --git a/internal/lsp/testdata/rename/crosspkg/another/another.go.golden b/internal/lsp/testdata/rename/crosspkg/another/another.go.golden deleted file mode 100644 index d3fccdaf1..000000000 --- a/internal/lsp/testdata/rename/crosspkg/another/another.go.golden +++ /dev/null @@ -1,15 +0,0 @@ --- G-rename -- -package another - -type ( - I interface{ G() } - C struct{ I } -) - -func (C) g() - -func _() { - var x I = C{} - x.G() //@rename("F", "G") -} - diff --git a/internal/lsp/testdata/rename/crosspkg/crosspkg.go b/internal/lsp/testdata/rename/crosspkg/crosspkg.go deleted file mode 100644 index 8510bcfe0..000000000 --- a/internal/lsp/testdata/rename/crosspkg/crosspkg.go +++ /dev/null @@ -1,7 +0,0 @@ -package crosspkg - -func Foo() { //@rename("Foo", "Dolphin") - -} - -var Bar int //@rename("Bar", "Tomato") diff --git a/internal/lsp/testdata/rename/crosspkg/crosspkg.go.golden b/internal/lsp/testdata/rename/crosspkg/crosspkg.go.golden deleted file mode 100644 index 810926de6..000000000 --- a/internal/lsp/testdata/rename/crosspkg/crosspkg.go.golden +++ /dev/null @@ -1,40 +0,0 @@ --- Dolphin-rename -- -crosspkg.go: -package crosspkg - -func Dolphin() { //@rename("Foo", "Dolphin") - -} - -var Bar int //@rename("Bar", "Tomato") - -other.go: -package other - -import "golang.org/x/tools/internal/lsp/rename/crosspkg" - -func Other() { - crosspkg.Bar - crosspkg.Dolphin() //@rename("Foo", "Flamingo") -} - --- Tomato-rename -- -crosspkg.go: -package crosspkg - -func Foo() { //@rename("Foo", "Dolphin") - -} - -var Tomato int //@rename("Bar", "Tomato") - -other.go: -package other - -import "golang.org/x/tools/internal/lsp/rename/crosspkg" - -func Other() { - crosspkg.Tomato - crosspkg.Foo() //@rename("Foo", "Flamingo") -} - diff --git a/internal/lsp/testdata/rename/crosspkg/other/other.go b/internal/lsp/testdata/rename/crosspkg/other/other.go deleted file mode 100644 index 10d17cd34..000000000 --- a/internal/lsp/testdata/rename/crosspkg/other/other.go +++ /dev/null @@ -1,8 +0,0 @@ -package other - -import "golang.org/x/tools/internal/lsp/rename/crosspkg" - -func Other() { - crosspkg.Bar - crosspkg.Foo() //@rename("Foo", "Flamingo") -} diff --git a/internal/lsp/testdata/rename/crosspkg/other/other.go.golden b/internal/lsp/testdata/rename/crosspkg/other/other.go.golden deleted file mode 100644 index 2722ad96e..000000000 --- a/internal/lsp/testdata/rename/crosspkg/other/other.go.golden +++ /dev/null @@ -1,20 +0,0 @@ --- Flamingo-rename -- -crosspkg.go: -package crosspkg - -func Flamingo() { //@rename("Foo", "Dolphin") - -} - -var Bar int //@rename("Bar", "Tomato") - -other.go: -package other - -import "golang.org/x/tools/internal/lsp/rename/crosspkg" - -func Other() { - crosspkg.Bar - crosspkg.Flamingo() //@rename("Foo", "Flamingo") -} - diff --git a/internal/lsp/testdata/rename/generics/embedded.go b/internal/lsp/testdata/rename/generics/embedded.go deleted file mode 100644 index b44bab880..000000000 --- a/internal/lsp/testdata/rename/generics/embedded.go +++ /dev/null @@ -1,10 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -package generics - -type foo[P any] int //@rename("foo","bar") - -var x struct{ foo[int] } - -var _ = x.foo diff --git a/internal/lsp/testdata/rename/generics/embedded.go.golden b/internal/lsp/testdata/rename/generics/embedded.go.golden deleted file mode 100644 index faa9afb69..000000000 --- a/internal/lsp/testdata/rename/generics/embedded.go.golden +++ /dev/null @@ -1,12 +0,0 @@ --- bar-rename -- -//go:build go1.18 -// +build go1.18 - -package generics - -type bar[P any] int //@rename("foo","bar") - -var x struct{ bar[int] } - -var _ = x.bar - diff --git a/internal/lsp/testdata/rename/generics/generics.go b/internal/lsp/testdata/rename/generics/generics.go deleted file mode 100644 index 977589c0c..000000000 --- a/internal/lsp/testdata/rename/generics/generics.go +++ /dev/null @@ -1,25 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -package generics - -type G[P any] struct { - F int -} - -func (G[_]) M() {} - -func F[P any](P) { - var p P //@rename("P", "Q") - _ = p -} - -func _() { - var x G[int] //@rename("G", "H") - _ = x.F //@rename("F", "K") - x.M() //@rename("M", "N") - - var y G[string] - _ = y.F - y.M() -} diff --git a/internal/lsp/testdata/rename/generics/generics.go.golden b/internal/lsp/testdata/rename/generics/generics.go.golden deleted file mode 100644 index 7d39813e1..000000000 --- a/internal/lsp/testdata/rename/generics/generics.go.golden +++ /dev/null @@ -1,108 +0,0 @@ --- H-rename -- -//go:build go1.18 -// +build go1.18 - -package generics - -type H[P any] struct { - F int -} - -func (H[_]) M() {} - -func F[P any](P) { - var p P //@rename("P", "Q") - _ = p -} - -func _() { - var x H[int] //@rename("G", "H") - _ = x.F //@rename("F", "K") - x.M() //@rename("M", "N") - - var y H[string] - _ = y.F - y.M() -} - --- K-rename -- -//go:build go1.18 -// +build go1.18 - -package generics - -type G[P any] struct { - K int -} - -func (G[_]) M() {} - -func F[P any](P) { - var p P //@rename("P", "Q") - _ = p -} - -func _() { - var x G[int] //@rename("G", "H") - _ = x.K //@rename("F", "K") - x.M() //@rename("M", "N") - - var y G[string] - _ = y.K - y.M() -} - --- N-rename -- -//go:build go1.18 -// +build go1.18 - -package generics - -type G[P any] struct { - F int -} - -func (G[_]) N() {} - -func F[P any](P) { - var p P //@rename("P", "Q") - _ = p -} - -func _() { - var x G[int] //@rename("G", "H") - _ = x.F //@rename("F", "K") - x.N() //@rename("M", "N") - - var y G[string] - _ = y.F - y.N() -} - --- Q-rename -- -//go:build go1.18 -// +build go1.18 - -package generics - -type G[P any] struct { - F int -} - -func (G[_]) M() {} - -func F[Q any](Q) { - var p Q //@rename("P", "Q") - _ = p -} - -func _() { - var x G[int] //@rename("G", "H") - _ = x.F //@rename("F", "K") - x.M() //@rename("M", "N") - - var y G[string] - _ = y.F - y.M() -} - diff --git a/internal/lsp/testdata/rename/generics/unions.go b/internal/lsp/testdata/rename/generics/unions.go deleted file mode 100644 index c737b5c27..000000000 --- a/internal/lsp/testdata/rename/generics/unions.go +++ /dev/null @@ -1,10 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -package generics - -type T string //@rename("T", "R") - -type C interface { - T | ~int //@rename("T", "S") -} diff --git a/internal/lsp/testdata/rename/generics/unions.go.golden b/internal/lsp/testdata/rename/generics/unions.go.golden deleted file mode 100644 index 463289629..000000000 --- a/internal/lsp/testdata/rename/generics/unions.go.golden +++ /dev/null @@ -1,24 +0,0 @@ --- R-rename -- -//go:build go1.18 -// +build go1.18 - -package generics - -type R string //@rename("T", "R") - -type C interface { - R | ~int //@rename("T", "S") -} - --- S-rename -- -//go:build go1.18 -// +build go1.18 - -package generics - -type S string //@rename("T", "R") - -type C interface { - S | ~int //@rename("T", "S") -} - diff --git a/internal/lsp/testdata/rename/issue39614/issue39614.go.golden b/internal/lsp/testdata/rename/issue39614/issue39614.go.golden deleted file mode 100644 index d87c58e83..000000000 --- a/internal/lsp/testdata/rename/issue39614/issue39614.go.golden +++ /dev/null @@ -1,10 +0,0 @@ --- bar-rename -- -package issue39614 - -func fn() { - var bar bool //@rename("foo","bar") - make(map[string]bool - if true { - } -} - diff --git a/internal/lsp/testdata/rename/issue39614/issue39614.go.in b/internal/lsp/testdata/rename/issue39614/issue39614.go.in deleted file mode 100644 index 8222db2c4..000000000 --- a/internal/lsp/testdata/rename/issue39614/issue39614.go.in +++ /dev/null @@ -1,8 +0,0 @@ -package issue39614 - -func fn() { - var foo bool //@rename("foo","bar") - make(map[string]bool - if true { - } -} diff --git a/internal/lsp/testdata/rename/issue42134/1.go b/internal/lsp/testdata/rename/issue42134/1.go deleted file mode 100644 index 056f8476a..000000000 --- a/internal/lsp/testdata/rename/issue42134/1.go +++ /dev/null @@ -1,8 +0,0 @@ -package issue42134 - -func _() { - // foo computes things. - foo := func() {} - - foo() //@rename("foo", "bar") -} diff --git a/internal/lsp/testdata/rename/issue42134/1.go.golden b/internal/lsp/testdata/rename/issue42134/1.go.golden deleted file mode 100644 index 266aeef4b..000000000 --- a/internal/lsp/testdata/rename/issue42134/1.go.golden +++ /dev/null @@ -1,10 +0,0 @@ --- bar-rename -- -package issue42134 - -func _() { - // bar computes things. - bar := func() {} - - bar() //@rename("foo", "bar") -} - diff --git a/internal/lsp/testdata/rename/issue42134/2.go b/internal/lsp/testdata/rename/issue42134/2.go deleted file mode 100644 index e9f639575..000000000 --- a/internal/lsp/testdata/rename/issue42134/2.go +++ /dev/null @@ -1,12 +0,0 @@ -package issue42134 - -import "fmt" - -func _() { - // minNumber is a min number. - // Second line. - minNumber := min(1, 2) - fmt.Println(minNumber) //@rename("minNumber", "res") -} - -func min(a, b int) int { return a } diff --git a/internal/lsp/testdata/rename/issue42134/2.go.golden b/internal/lsp/testdata/rename/issue42134/2.go.golden deleted file mode 100644 index 406a3833c..000000000 --- a/internal/lsp/testdata/rename/issue42134/2.go.golden +++ /dev/null @@ -1,14 +0,0 @@ --- res-rename -- -package issue42134 - -import "fmt" - -func _() { - // res is a min number. - // Second line. - res := min(1, 2) - fmt.Println(res) //@rename("minNumber", "res") -} - -func min(a, b int) int { return a } - diff --git a/internal/lsp/testdata/rename/issue42134/3.go b/internal/lsp/testdata/rename/issue42134/3.go deleted file mode 100644 index 7666f57d3..000000000 --- a/internal/lsp/testdata/rename/issue42134/3.go +++ /dev/null @@ -1,11 +0,0 @@ -package issue42134 - -func _() { - /* - tests contains test cases - */ - tests := []struct { //@rename("tests", "testCases") - in, out string - }{} - _ = tests -} diff --git a/internal/lsp/testdata/rename/issue42134/3.go.golden b/internal/lsp/testdata/rename/issue42134/3.go.golden deleted file mode 100644 index cdcae1808..000000000 --- a/internal/lsp/testdata/rename/issue42134/3.go.golden +++ /dev/null @@ -1,13 +0,0 @@ --- testCases-rename -- -package issue42134 - -func _() { - /* - testCases contains test cases - */ - testCases := []struct { //@rename("tests", "testCases") - in, out string - }{} - _ = testCases -} - diff --git a/internal/lsp/testdata/rename/issue42134/4.go b/internal/lsp/testdata/rename/issue42134/4.go deleted file mode 100644 index c953520bc..000000000 --- a/internal/lsp/testdata/rename/issue42134/4.go +++ /dev/null @@ -1,8 +0,0 @@ -package issue42134 - -func _() { - // a is equal to 5. Comment must stay the same - - a := 5 - _ = a //@rename("a", "b") -} diff --git a/internal/lsp/testdata/rename/issue42134/4.go.golden b/internal/lsp/testdata/rename/issue42134/4.go.golden deleted file mode 100644 index 2086cf74c..000000000 --- a/internal/lsp/testdata/rename/issue42134/4.go.golden +++ /dev/null @@ -1,10 +0,0 @@ --- b-rename -- -package issue42134 - -func _() { - // a is equal to 5. Comment must stay the same - - b := 5 - _ = b //@rename("a", "b") -} - diff --git a/internal/lsp/testdata/rename/issue43616/issue43616.go.golden b/internal/lsp/testdata/rename/issue43616/issue43616.go.golden deleted file mode 100644 index 34d03ba7a..000000000 --- a/internal/lsp/testdata/rename/issue43616/issue43616.go.golden +++ /dev/null @@ -1,13 +0,0 @@ --- bar-rename -- -package issue43616 - -type bar int //@rename("foo","bar"),prepare("oo","foo","foo") - -var x struct{ bar } //@rename("foo","baz") - -var _ = x.bar //@rename("foo","quux") - --- baz-rename -- -can't rename embedded fields: rename the type directly or name the field --- quux-rename -- -can't rename embedded fields: rename the type directly or name the field diff --git a/internal/lsp/testdata/rename/issue43616/issue43616.go.in b/internal/lsp/testdata/rename/issue43616/issue43616.go.in deleted file mode 100644 index aaad531b7..000000000 --- a/internal/lsp/testdata/rename/issue43616/issue43616.go.in +++ /dev/null @@ -1,7 +0,0 @@ -package issue43616 - -type foo int //@rename("foo","bar"),prepare("oo","foo","foo") - -var x struct{ foo } //@rename("foo","baz") - -var _ = x.foo //@rename("foo","quux") diff --git a/internal/lsp/testdata/rename/shadow/shadow.go b/internal/lsp/testdata/rename/shadow/shadow.go deleted file mode 100644 index 38329b4fe..000000000 --- a/internal/lsp/testdata/rename/shadow/shadow.go +++ /dev/null @@ -1,20 +0,0 @@ -package shadow - -func _() { - a := true - b, c, _ := A(), B(), D() //@rename("A", "a"),rename("B", "b"),rename("b", "c"),rename("D", "d") - d := false - _, _, _, _ = a, b, c, d -} - -func A() int { - return 0 -} - -func B() int { - return 0 -} - -func D() int { - return 0 -} diff --git a/internal/lsp/testdata/rename/shadow/shadow.go.golden b/internal/lsp/testdata/rename/shadow/shadow.go.golden deleted file mode 100644 index 6281bcdd9..000000000 --- a/internal/lsp/testdata/rename/shadow/shadow.go.golden +++ /dev/null @@ -1,48 +0,0 @@ --- a-rename -- -renaming this func "A" to "a" would cause this reference to become shadowed by this intervening var definition --- b-rename -- -package shadow - -func _() { - a := true - b, c, _ := A(), b(), D() //@rename("A", "a"),rename("B", "b"),rename("b", "c"),rename("D", "d") - d := false - _, _, _, _ = a, b, c, d -} - -func A() int { - return 0 -} - -func b() int { - return 0 -} - -func D() int { - return 0 -} - --- c-rename -- -renaming this var "b" to "c" conflicts with var in same block --- d-rename -- -package shadow - -func _() { - a := true - b, c, _ := A(), B(), d() //@rename("A", "a"),rename("B", "b"),rename("b", "c"),rename("D", "d") - d := false - _, _, _, _ = a, b, c, d -} - -func A() int { - return 0 -} - -func B() int { - return 0 -} - -func d() int { - return 0 -} - diff --git a/internal/lsp/testdata/rename/testy/testy.go b/internal/lsp/testdata/rename/testy/testy.go deleted file mode 100644 index e46dc06cd..000000000 --- a/internal/lsp/testdata/rename/testy/testy.go +++ /dev/null @@ -1,7 +0,0 @@ -package testy - -type tt int //@rename("tt", "testyType") - -func a() { - foo := 42 //@rename("foo", "bar") -} diff --git a/internal/lsp/testdata/rename/testy/testy.go.golden b/internal/lsp/testdata/rename/testy/testy.go.golden deleted file mode 100644 index 288dfee96..000000000 --- a/internal/lsp/testdata/rename/testy/testy.go.golden +++ /dev/null @@ -1,18 +0,0 @@ --- bar-rename -- -package testy - -type tt int //@rename("tt", "testyType") - -func a() { - bar := 42 //@rename("foo", "bar") -} - --- testyType-rename -- -package testy - -type testyType int //@rename("tt", "testyType") - -func a() { - foo := 42 //@rename("foo", "bar") -} - diff --git a/internal/lsp/testdata/rename/testy/testy_test.go b/internal/lsp/testdata/rename/testy/testy_test.go deleted file mode 100644 index 3d86e8455..000000000 --- a/internal/lsp/testdata/rename/testy/testy_test.go +++ /dev/null @@ -1,8 +0,0 @@ -package testy - -import "testing" - -func TestSomething(t *testing.T) { - var x int //@rename("x", "testyX") - a() //@rename("a", "b") -} diff --git a/internal/lsp/testdata/rename/testy/testy_test.go.golden b/internal/lsp/testdata/rename/testy/testy_test.go.golden deleted file mode 100644 index 480c8e995..000000000 --- a/internal/lsp/testdata/rename/testy/testy_test.go.golden +++ /dev/null @@ -1,30 +0,0 @@ --- b-rename -- -testy.go: -package testy - -type tt int //@rename("tt", "testyType") - -func b() { - foo := 42 //@rename("foo", "bar") -} - -testy_test.go: -package testy - -import "testing" - -func TestSomething(t *testing.T) { - var x int //@rename("x", "testyX") - b() //@rename("a", "b") -} - --- testyX-rename -- -package testy - -import "testing" - -func TestSomething(t *testing.T) { - var testyX int //@rename("x", "testyX") - a() //@rename("a", "b") -} - diff --git a/internal/lsp/testdata/selector/selector.go.in b/internal/lsp/testdata/selector/selector.go.in deleted file mode 100644 index 277f98bde..000000000 --- a/internal/lsp/testdata/selector/selector.go.in +++ /dev/null @@ -1,66 +0,0 @@ -// +build go1.11 - -package selector - -import ( - "golang.org/x/tools/internal/lsp/bar" -) - -type S struct { - B, A, C int //@item(Bf, "B", "int", "field"),item(Af, "A", "int", "field"),item(Cf, "C", "int", "field") -} - -func _() { - _ = S{}.; //@complete(";", Af, Bf, Cf) -} - -type bob struct { a int } //@item(a, "a", "int", "field") -type george struct { b int } -type jack struct { c int } //@item(c, "c", "int", "field") -type jill struct { d int } - -func (b *bob) george() *george {} //@item(george, "george", "func() *george", "method") -func (g *george) jack() *jack {} -func (j *jack) jill() *jill {} //@item(jill, "jill", "func() *jill", "method") - -func _() { - b := &bob{} - y := b.george(). - jack(); - y.; //@complete(";", c, jill) -} - -func _() { - bar. //@complete(" /", Bar) - x := 5 - - var b *bob - b. //@complete(" /", a, george) - y, z := 5, 6 - - b. //@complete(" /", a, george) - y, z, a, b, c := 5, 6 -} - -func _() { - bar. //@complete(" /", Bar) - bar.Bar() - - bar. //@complete(" /", Bar) - go f() -} - -func _() { - var b *bob - if y != b. //@complete(" /", a, george) - z := 5 - - if z + y + 1 + b. //@complete(" /", a, george) - r, s, t := 4, 5 - - if y != b. //@complete(" /", a, george) - z = 5 - - if z + y + 1 + b. //@complete(" /", a, george) - r = 4 -} diff --git a/internal/lsp/testdata/semantic/README.md b/internal/lsp/testdata/semantic/README.md deleted file mode 100644 index 00ec19af1..000000000 --- a/internal/lsp/testdata/semantic/README.md +++ /dev/null @@ -1,2 +0,0 @@ -The golden files are the output of `gopls semtok <src-file>`, with `-- semantic --` -inserted as the first line (the spaces are mandatory) and an extra newline at the end. diff --git a/internal/lsp/testdata/semantic/a.go b/internal/lsp/testdata/semantic/a.go deleted file mode 100644 index 54d6c8a62..000000000 --- a/internal/lsp/testdata/semantic/a.go +++ /dev/null @@ -1,81 +0,0 @@ -package semantictokens //@ semantic("") - -import ( - _ "encoding/utf8" - utf "encoding/utf8" - "fmt" //@ semantic("fmt") - . "fmt" - "unicode/utf8" -) - -var ( - a = fmt.Print - b []string = []string{"foo"} - c1 chan int - c2 <-chan int - c3 = make([]chan<- int) - b = A{X: 23} - m map[bool][3]*float64 -) - -const ( - xx F = iota - yy = xx + 3 - zz = "" - ww = "not " + zz -) - -type A struct { - X int `foof` -} -type B interface { - A - sad(int) bool -} - -type F int - -func (a *A) f() bool { - var z string - x := "foo" - a(x) - y := "bar" + x - switch z { - case "xx": - default: - } - select { - case z := <-c3[0]: - default: - } - for k, v := range m { - return (!k) && v[0] == nil - } - c2 <- A.X - w := b[4:] - j := len(x) - j-- - q := []interface{}{j, 23i, &y} - g(q...) - return true -} - -func g(vv ...interface{}) { - ff := func() {} - defer ff() - go utf.RuneCount("") - go utf8.RuneCount(vv.(string)) - if true { - } else { - } -Never: - for i := 0; i < 10; { - break Never - } - _, ok := vv[0].(A) - if !ok { - switch x := vv[0].(type) { - } - goto Never - } -} diff --git a/internal/lsp/testdata/semantic/a.go.golden b/internal/lsp/testdata/semantic/a.go.golden deleted file mode 100644 index 4622ae4d7..000000000 --- a/internal/lsp/testdata/semantic/a.go.golden +++ /dev/null @@ -1,83 +0,0 @@ --- semantic -- -/*⇒7,keyword,[]*/package /*⇒14,namespace,[]*/semantictokens /*⇒16,comment,[]*///@ semantic("") - -/*⇒6,keyword,[]*/import ( - _ "encoding/utf8" - /*⇒3,namespace,[]*/utf "encoding/utf8" - "fmt"/*⇐3,namespace,[]*/ /*⇒19,comment,[]*///@ semantic("fmt") - . "fmt" - "unicode/utf8"/*⇐4,namespace,[]*/ -) - -/*⇒3,keyword,[]*/var ( - /*⇒1,variable,[definition]*/a = /*⇒3,namespace,[]*/fmt./*⇒5,function,[]*/Print - /*⇒1,variable,[definition]*/b []/*⇒6,type,[defaultLibrary]*/string = []/*⇒6,type,[defaultLibrary]*/string{/*⇒5,string,[]*/"foo"} - /*⇒2,variable,[definition]*/c1 /*⇒4,keyword,[]*/chan /*⇒3,type,[defaultLibrary]*/int - /*⇒2,variable,[definition]*/c2 <-/*⇒4,keyword,[]*/chan /*⇒3,type,[defaultLibrary]*/int - /*⇒2,variable,[definition]*/c3 = /*⇒4,function,[defaultLibrary]*/make([]/*⇒4,keyword,[]*/chan<- /*⇒3,type,[defaultLibrary]*/int) - /*⇒1,variable,[definition]*/b = /*⇒1,type,[]*/A{/*⇒1,variable,[]*/X: /*⇒2,number,[]*/23} - /*⇒1,variable,[definition]*/m /*⇒3,keyword,[]*/map[/*⇒4,type,[defaultLibrary]*/bool][/*⇒1,number,[]*/3]/*⇒1,operator,[]*/*/*⇒7,type,[defaultLibrary]*/float64 -) - -/*⇒5,keyword,[]*/const ( - /*⇒2,variable,[definition readonly]*/xx /*⇒1,type,[]*/F = /*⇒4,variable,[readonly]*/iota - /*⇒2,variable,[definition readonly]*/yy = /*⇒2,variable,[readonly]*/xx /*⇒1,operator,[]*/+ /*⇒1,number,[]*/3 - /*⇒2,variable,[definition readonly]*/zz = /*⇒2,string,[]*/"" - /*⇒2,variable,[definition readonly]*/ww = /*⇒6,string,[]*/"not " /*⇒1,operator,[]*/+ /*⇒2,variable,[readonly]*/zz -) - -/*⇒4,keyword,[]*/type /*⇒1,type,[definition]*/A /*⇒6,keyword,[]*/struct { - /*⇒1,variable,[definition]*/X /*⇒3,type,[defaultLibrary]*/int /*⇒6,comment,[]*/`foof` -} -/*⇒4,keyword,[]*/type /*⇒1,type,[definition]*/B /*⇒9,keyword,[]*/interface { - /*⇒1,type,[]*/A - /*⇒3,method,[definition]*/sad(/*⇒3,type,[defaultLibrary]*/int) /*⇒4,type,[defaultLibrary]*/bool -} - -/*⇒4,keyword,[]*/type /*⇒1,type,[definition]*/F /*⇒3,type,[defaultLibrary]*/int - -/*⇒4,keyword,[]*/func (/*⇒1,variable,[]*/a /*⇒1,operator,[]*/*/*⇒1,type,[]*/A) /*⇒1,method,[definition]*/f() /*⇒4,type,[defaultLibrary]*/bool { - /*⇒3,keyword,[]*/var /*⇒1,variable,[definition]*/z /*⇒6,type,[defaultLibrary]*/string - /*⇒1,variable,[definition]*/x /*⇒2,operator,[]*/:= /*⇒5,string,[]*/"foo" - /*⇒1,variable,[]*/a(/*⇒1,variable,[]*/x) - /*⇒1,variable,[definition]*/y /*⇒2,operator,[]*/:= /*⇒5,string,[]*/"bar" /*⇒1,operator,[]*/+ /*⇒1,variable,[]*/x - /*⇒6,keyword,[]*/switch /*⇒1,variable,[]*/z { - /*⇒4,keyword,[]*/case /*⇒4,string,[]*/"xx": - /*⇒7,keyword,[]*/default: - } - /*⇒6,keyword,[]*/select { - /*⇒4,keyword,[]*/case /*⇒1,variable,[definition]*/z /*⇒2,operator,[]*/:= /*⇒2,operator,[]*/<-/*⇒2,variable,[]*/c3[/*⇒1,number,[]*/0]: - /*⇒7,keyword,[]*/default: - } - /*⇒3,keyword,[]*/for /*⇒1,variable,[definition]*/k, /*⇒1,variable,[definition]*/v := /*⇒5,keyword,[]*/range /*⇒1,variable,[]*/m { - /*⇒6,keyword,[]*/return (/*⇒1,operator,[]*/!/*⇒1,variable,[]*/k) /*⇒2,operator,[]*/&& /*⇒1,variable,[]*/v[/*⇒1,number,[]*/0] /*⇒2,operator,[]*/== /*⇒3,variable,[readonly defaultLibrary]*/nil - } - /*⇒2,variable,[]*/c2 /*⇒2,operator,[]*/<- /*⇒1,type,[]*/A./*⇒1,variable,[]*/X - /*⇒1,variable,[definition]*/w /*⇒2,operator,[]*/:= /*⇒1,variable,[]*/b[/*⇒1,number,[]*/4:] - /*⇒1,variable,[definition]*/j /*⇒2,operator,[]*/:= /*⇒3,function,[defaultLibrary]*/len(/*⇒1,variable,[]*/x) - /*⇒1,variable,[]*/j/*⇒2,operator,[]*/-- - /*⇒1,variable,[definition]*/q /*⇒2,operator,[]*/:= []/*⇒9,keyword,[]*/interface{}{/*⇒1,variable,[]*/j, /*⇒3,number,[]*/23i, /*⇒1,operator,[]*/&/*⇒1,variable,[]*/y} - /*⇒1,function,[]*/g(/*⇒1,variable,[]*/q/*⇒3,operator,[]*/...) - /*⇒6,keyword,[]*/return /*⇒4,variable,[readonly]*/true -} - -/*⇒4,keyword,[]*/func /*⇒1,function,[definition]*/g(/*⇒2,parameter,[definition]*/vv /*⇒3,operator,[]*/.../*⇒9,keyword,[]*/interface{}) { - /*⇒2,variable,[definition]*/ff /*⇒2,operator,[]*/:= /*⇒4,keyword,[]*/func() {} - /*⇒5,keyword,[]*/defer /*⇒2,variable,[]*/ff() - /*⇒2,keyword,[]*/go /*⇒3,namespace,[]*/utf./*⇒9,function,[]*/RuneCount(/*⇒2,string,[]*/"") - /*⇒2,keyword,[]*/go /*⇒4,namespace,[]*/utf8./*⇒9,function,[]*/RuneCount(/*⇒2,variable,[]*/vv.(/*⇒6,type,[]*/string)) - /*⇒2,keyword,[]*/if /*⇒4,variable,[readonly]*/true { - } /*⇒4,keyword,[]*/else { - } -/*⇒5,parameter,[definition]*/Never: - /*⇒3,keyword,[]*/for /*⇒1,variable,[definition]*/i /*⇒2,operator,[]*/:= /*⇒1,number,[]*/0; /*⇒1,variable,[]*/i /*⇒1,operator,[]*/< /*⇒2,number,[]*/10; { - /*⇒5,keyword,[]*/break Never - } - _, /*⇒2,variable,[definition]*/ok /*⇒2,operator,[]*/:= /*⇒2,variable,[]*/vv[/*⇒1,number,[]*/0].(/*⇒1,type,[]*/A) - /*⇒2,keyword,[]*/if /*⇒1,operator,[]*/!/*⇒2,variable,[]*/ok { - /*⇒6,keyword,[]*/switch /*⇒1,variable,[definition]*/x /*⇒2,operator,[]*/:= /*⇒2,variable,[]*/vv[/*⇒1,number,[]*/0].(/*⇒4,keyword,[]*/type) { - } - /*⇒4,keyword,[]*/goto Never - } -} - diff --git a/internal/lsp/testdata/semantic/b.go b/internal/lsp/testdata/semantic/b.go deleted file mode 100644 index a536f97bf..000000000 --- a/internal/lsp/testdata/semantic/b.go +++ /dev/null @@ -1,34 +0,0 @@ -package semantictokens //@ semantic("") - -func f(x ...interface{}) { -} - -func weirⰀd() { /*😀*/ // comment - const ( - snil = nil - nil = true - true = false - false = snil - cmd = `foof` - double = iota - iota = copy - four = (len(cmd)/2 < 5) - five = four - ) - f(cmd, nil, double, iota) -} - -/* - -multiline */ /* -multiline -*/ -type AA int -type BB struct { - AA -} -type CC struct { - AA int -} -type D func(aa AA) (BB error) -type E func(AA) BB diff --git a/internal/lsp/testdata/semantic/b.go.golden b/internal/lsp/testdata/semantic/b.go.golden deleted file mode 100644 index 203f6b189..000000000 --- a/internal/lsp/testdata/semantic/b.go.golden +++ /dev/null @@ -1,36 +0,0 @@ --- semantic -- -/*⇒7,keyword,[]*/package /*⇒14,namespace,[]*/semantictokens /*⇒16,comment,[]*///@ semantic("") - -/*⇒4,keyword,[]*/func /*⇒1,function,[definition]*/f(/*⇒1,parameter,[definition]*/x /*⇒3,operator,[]*/.../*⇒9,keyword,[]*/interface{}) { -} - -/*⇒4,keyword,[]*/func /*⇒6,function,[definition]*/weirⰀd() { /*⇒5,comment,[]*//*😀*/ /*⇒10,comment,[]*/// comment - /*⇒5,keyword,[]*/const ( - /*⇒4,variable,[definition readonly]*/snil = /*⇒3,variable,[readonly defaultLibrary]*/nil - /*⇒3,variable,[definition readonly]*/nil = /*⇒4,variable,[readonly]*/true - /*⇒4,variable,[definition readonly]*/true = /*⇒5,variable,[readonly]*/false - /*⇒5,variable,[definition readonly]*/false = /*⇒4,variable,[readonly]*/snil - /*⇒3,variable,[definition readonly]*/cmd = /*⇒6,string,[]*/`foof` - /*⇒6,variable,[definition readonly]*/double = /*⇒4,variable,[readonly]*/iota - /*⇒4,variable,[definition readonly]*/iota = /*⇒4,function,[defaultLibrary]*/copy - /*⇒4,variable,[definition readonly]*/four = (/*⇒3,function,[defaultLibrary]*/len(/*⇒3,variable,[readonly]*/cmd)/*⇒1,operator,[]*// /*⇒1,number,[]*/2 /*⇒1,operator,[]*/< /*⇒1,number,[]*/5) - /*⇒4,variable,[definition readonly]*/five = /*⇒4,variable,[readonly]*/four - ) - /*⇒1,function,[]*/f(/*⇒3,variable,[readonly]*/cmd, /*⇒3,variable,[readonly]*/nil, /*⇒6,variable,[readonly]*/double, /*⇒4,variable,[readonly]*/iota) -} - -/*⇒2,comment,[]*//* -/*⇒0,comment,[]*/ -/*⇒12,comment,[]*/multiline */ /*⇒2,comment,[]*//* -/*⇒9,comment,[]*/multiline -/*⇒2,comment,[]*/*/ -/*⇒4,keyword,[]*/type /*⇒2,type,[definition]*/AA /*⇒3,type,[defaultLibrary]*/int -/*⇒4,keyword,[]*/type /*⇒2,type,[definition]*/BB /*⇒6,keyword,[]*/struct { - /*⇒2,type,[]*/AA -} -/*⇒4,keyword,[]*/type /*⇒2,type,[definition]*/CC /*⇒6,keyword,[]*/struct { - /*⇒2,variable,[definition]*/AA /*⇒3,type,[defaultLibrary]*/int -} -/*⇒4,keyword,[]*/type /*⇒1,type,[definition]*/D /*⇒4,keyword,[]*/func(/*⇒2,parameter,[definition]*/aa /*⇒2,type,[]*/AA) (/*⇒2,parameter,[definition]*/BB /*⇒5,type,[]*/error) -/*⇒4,keyword,[]*/type /*⇒1,type,[definition]*/E /*⇒4,keyword,[]*/func(/*⇒2,type,[]*/AA) /*⇒2,type,[]*/BB - diff --git a/internal/lsp/testdata/semantic/semantic_test.go b/internal/lsp/testdata/semantic/semantic_test.go deleted file mode 100644 index 63d59f666..000000000 --- a/internal/lsp/testdata/semantic/semantic_test.go +++ /dev/null @@ -1,13 +0,0 @@ -package semantictokens - -import ( - "os" - "testing" -) - -func TestSemanticTokens(t *testing.T) { - a, _ := os.Getwd() - // climb up to find internal/lsp - // find all the .go files - -} diff --git a/internal/lsp/testdata/signature/signature.go b/internal/lsp/testdata/signature/signature.go deleted file mode 100644 index 4e2b12bc4..000000000 --- a/internal/lsp/testdata/signature/signature.go +++ /dev/null @@ -1,85 +0,0 @@ -// Package signature has tests for signature help. -package signature - -import ( - "bytes" - "encoding/json" - "math/big" -) - -func Foo(a string, b int) (c bool) { - return -} - -func Bar(float64, ...byte) { -} - -type myStruct struct{} - -func (*myStruct) foo(e *json.Decoder) (*big.Int, error) { - return nil, nil -} - -type MyType struct{} - -type MyFunc func(foo int) string - -type Alias = int -type OtherAlias = int -type StringAlias = string - -func AliasSlice(a []*Alias) (b Alias) { return 0 } -func AliasMap(a map[*Alias]StringAlias) (b, c map[*Alias]StringAlias) { return nil, nil } -func OtherAliasMap(a, b map[Alias]OtherAlias) map[Alias]OtherAlias { return nil } - -func Qux() { - Foo("foo", 123) //@signature("(", "Foo(a string, b int) (c bool)", 0) - Foo("foo", 123) //@signature("123", "Foo(a string, b int) (c bool)", 1) - Foo("foo", 123) //@signature(",", "Foo(a string, b int) (c bool)", 0) - Foo("foo", 123) //@signature(" 1", "Foo(a string, b int) (c bool)", 1) - Foo("foo", 123) //@signature(")", "Foo(a string, b int) (c bool)", 1) - - Bar(13.37, 0x13) //@signature("13.37", "Bar(float64, ...byte)", 0) - Bar(13.37, 0x37) //@signature("0x37", "Bar(float64, ...byte)", 1) - Bar(13.37, 1, 2, 3, 4) //@signature("4", "Bar(float64, ...byte)", 1) - - fn := func(hi, there string) func(i int) rune { - return func(int) rune { return 0 } - } - - fn("hi", "there") //@signature("hi", "", 0) - fn("hi", "there") //@signature(",", "fn(hi string, there string) func(i int) rune", 0) - fn("hi", "there")(1) //@signature("1", "func(i int) rune", 0) - - fnPtr := &fn - (*fnPtr)("hi", "there") //@signature(",", "func(hi string, there string) func(i int) rune", 0) - - var fnIntf interface{} = Foo - fnIntf.(func(string, int) bool)("hi", 123) //@signature("123", "func(string, int) bool", 1) - - (&bytes.Buffer{}).Next(2) //@signature("2", "Next(n int) []byte", 0) - - myFunc := MyFunc(func(n int) string { return "" }) - myFunc(123) //@signature("123", "myFunc(foo int) string", 0) - - var ms myStruct - ms.foo(nil) //@signature("nil", "foo(e *json.Decoder) (*big.Int, error)", 0) - - _ = make([]int, 1, 2) //@signature("2", "make(t Type, size ...int) Type", 1) - - Foo(myFunc(123), 456) //@signature("myFunc", "Foo(a string, b int) (c bool)", 0) - Foo(myFunc(123), 456) //@signature("123", "myFunc(foo int) string", 0) - - panic("oops!") //@signature(")", "panic(v interface{})", 0) - println("hello", "world") //@signature(",", "println(args ...Type)", 0) - - Hello(func() { - //@signature("//", "", 0) - }) - - AliasSlice() //@signature(")", "AliasSlice(a []*Alias) (b Alias)", 0) - AliasMap() //@signature(")", "AliasMap(a map[*Alias]StringAlias) (b map[*Alias]StringAlias, c map[*Alias]StringAlias)", 0) - OtherAliasMap() //@signature(")", "OtherAliasMap(a map[Alias]OtherAlias, b map[Alias]OtherAlias) map[Alias]OtherAlias", 0) -} - -func Hello(func()) {} diff --git a/internal/lsp/testdata/signature/signature.go.golden b/internal/lsp/testdata/signature/signature.go.golden deleted file mode 100644 index d7a65b3b8..000000000 --- a/internal/lsp/testdata/signature/signature.go.golden +++ /dev/null @@ -1,65 +0,0 @@ --- AliasMap(a map[*Alias]StringAlias) (b map[*Alias]StringAlias, c map[*Alias]StringAlias)-signature -- -AliasMap(a map[*Alias]StringAlias) (b map[*Alias]StringAlias, c map[*Alias]StringAlias) - --- AliasSlice(a []*Alias) (b Alias)-signature -- -AliasSlice(a []*Alias) (b Alias) - --- Bar(float64, ...byte)-signature -- -Bar(float64, ...byte) - --- Foo(a string, b int) (c bool)-signature -- -Foo(a string, b int) (c bool) - --- GetAlias() Alias-signature -- -GetAlias() Alias - --- GetAliasPtr() *Alias-signature -- -GetAliasPtr() *Alias - --- Next(n int) []byte-signature -- -Next(n int) []byte - -Next returns a slice containing the next n bytes from the buffer, advancing the buffer as if the bytes had been returned by Read. - --- OtherAliasMap(a map[Alias]OtherAlias, b map[Alias]OtherAlias) map[Alias]OtherAlias-signature -- -OtherAliasMap(a map[Alias]OtherAlias, b map[Alias]OtherAlias) map[Alias]OtherAlias - --- SetAliasSlice(a []*Alias)-signature -- -SetAliasSlice(a []*Alias) - --- SetOtherAliasMap(a map[*Alias]OtherAlias)-signature -- -SetOtherAliasMap(a map[*Alias]OtherAlias) - --- fn(hi string, there string) func(i int) rune-signature -- -fn(hi string, there string) func(i int) rune - --- foo(e *json.Decoder) (*big.Int, error)-signature -- -foo(e *json.Decoder) (*big.Int, error) - --- func(hi string, there string) func(i int) rune-signature -- -func(hi string, there string) func(i int) rune - --- func(i int) rune-signature -- -func(i int) rune - --- func(string, int) bool-signature -- -func(string, int) bool - --- make(t Type, size ...int) Type-signature -- -make(t Type, size ...int) Type - -The make built-in function allocates and initializes an object of type slice, map, or chan (only). - --- myFunc(foo int) string-signature -- -myFunc(foo int) string - --- panic(v interface{})-signature -- -panic(v any) - -The panic built-in function stops normal execution of the current goroutine. - --- println(args ...Type)-signature -- -println(args ...Type) - -The println built-in function formats its arguments in an implementation-specific way and writes the result to standard error. - diff --git a/internal/lsp/testdata/signature/signature2.go.golden b/internal/lsp/testdata/signature/signature2.go.golden deleted file mode 100644 index e8102584f..000000000 --- a/internal/lsp/testdata/signature/signature2.go.golden +++ /dev/null @@ -1,3 +0,0 @@ --- Foo(a string, b int) (c bool)-signature -- -Foo(a string, b int) (c bool) - diff --git a/internal/lsp/testdata/signature/signature2.go.in b/internal/lsp/testdata/signature/signature2.go.in deleted file mode 100644 index 16355ffc0..000000000 --- a/internal/lsp/testdata/signature/signature2.go.in +++ /dev/null @@ -1,5 +0,0 @@ -package signature - -func _() { - Foo(//@signature("//", "Foo(a string, b int) (c bool)", 0) -} diff --git a/internal/lsp/testdata/signature/signature3.go.golden b/internal/lsp/testdata/signature/signature3.go.golden deleted file mode 100644 index e8102584f..000000000 --- a/internal/lsp/testdata/signature/signature3.go.golden +++ /dev/null @@ -1,3 +0,0 @@ --- Foo(a string, b int) (c bool)-signature -- -Foo(a string, b int) (c bool) - diff --git a/internal/lsp/testdata/signature/signature3.go.in b/internal/lsp/testdata/signature/signature3.go.in deleted file mode 100644 index 032be1304..000000000 --- a/internal/lsp/testdata/signature/signature3.go.in +++ /dev/null @@ -1,5 +0,0 @@ -package signature - -func _() { - Foo("hello",//@signature("//", "Foo(a string, b int) (c bool)", 1) -}
\ No newline at end of file diff --git a/internal/lsp/testdata/signature/signature_test.go b/internal/lsp/testdata/signature/signature_test.go deleted file mode 100644 index 62e54a238..000000000 --- a/internal/lsp/testdata/signature/signature_test.go +++ /dev/null @@ -1,13 +0,0 @@ -package signature_test - -import ( - "testing" - - sig "golang.org/x/tools/internal/lsp/signature" -) - -func TestSignature(t *testing.T) { - sig.AliasSlice() //@signature(")", "AliasSlice(a []*sig.Alias) (b sig.Alias)", 0) - sig.AliasMap() //@signature(")", "AliasMap(a map[*sig.Alias]sig.StringAlias) (b map[*sig.Alias]sig.StringAlias, c map[*sig.Alias]sig.StringAlias)", 0) - sig.OtherAliasMap() //@signature(")", "OtherAliasMap(a map[sig.Alias]sig.OtherAlias, b map[sig.Alias]sig.OtherAlias) map[sig.Alias]sig.OtherAlias", 0) -} diff --git a/internal/lsp/testdata/signature/signature_test.go.golden b/internal/lsp/testdata/signature/signature_test.go.golden deleted file mode 100644 index 3853dffc9..000000000 --- a/internal/lsp/testdata/signature/signature_test.go.golden +++ /dev/null @@ -1,30 +0,0 @@ --- AliasMap(a map[*sig.Alias]sig.StringAlias) (b map[*sig.Alias]sig.StringAlias, c map[*sig.Alias]sig.StringAlias)-signature -- -AliasMap(a map[*sig.Alias]sig.StringAlias) (b map[*sig.Alias]sig.StringAlias, c map[*sig.Alias]sig.StringAlias) - --- AliasMap(a map[*signature.Alias]signature.StringAlias) (b map[*signature.Alias]signature.StringAlias, c map[*signature.Alias]signature.StringAlias)-signature -- -AliasMap(a map[*signature.Alias]signature.StringAlias) (b map[*signature.Alias]signature.StringAlias, c map[*signature.Alias]signature.StringAlias) - --- AliasSlice(a []*sig.Alias) (b sig.Alias)-signature -- -AliasSlice(a []*sig.Alias) (b sig.Alias) - --- AliasSlice(a []*signature.Alias) (b signature.Alias)-signature -- -AliasSlice(a []*signature.Alias) (b signature.Alias) - --- GetAlias() signature.Alias-signature -- -GetAlias() signature.Alias - --- GetAliasPtr() *signature.Alias-signature -- -GetAliasPtr() *signature.Alias - --- OtherAliasMap(a map[sig.Alias]sig.OtherAlias, b map[sig.Alias]sig.OtherAlias) map[sig.Alias]sig.OtherAlias-signature -- -OtherAliasMap(a map[sig.Alias]sig.OtherAlias, b map[sig.Alias]sig.OtherAlias) map[sig.Alias]sig.OtherAlias - --- OtherAliasMap(a map[signature.Alias]signature.OtherAlias, b map[signature.Alias]signature.OtherAlias) map[signature.Alias]signature.OtherAlias-signature -- -OtherAliasMap(a map[signature.Alias]signature.OtherAlias, b map[signature.Alias]signature.OtherAlias) map[signature.Alias]signature.OtherAlias - --- SetAliasSlice(a []*signature.Alias)-signature -- -SetAliasSlice(a []*signature.Alias) - --- SetOtherAliasMap(a map[*signature.Alias]signature.OtherAlias)-signature -- -SetOtherAliasMap(a map[*signature.Alias]signature.OtherAlias) - diff --git a/internal/lsp/testdata/snippets/func_snippets118.go.in b/internal/lsp/testdata/snippets/func_snippets118.go.in deleted file mode 100644 index d4933689d..000000000 --- a/internal/lsp/testdata/snippets/func_snippets118.go.in +++ /dev/null @@ -1,19 +0,0 @@ -// +build go1.18 -//go:build go1.18 - -package snippets - -type SyncMap[K comparable, V any] struct{} - -func NewSyncMap[K comparable, V any]() (result *SyncMap[K, V]) { //@item(NewSyncMap, "NewSyncMap", "", "") - return -} - -func Identity[P ~int](p P) P { //@item(Identity, "Identity", "", "") - return p -} - -func _() { - _ = NewSyncM //@snippet(" //", NewSyncMap, "NewSyncMap[${1:}]()", "NewSyncMap[${1:K comparable}, ${2:V any}]()") - _ = Identi //@snippet(" //", Identity, "Identity[${1:}](${2:})", "Identity[${1:P ~int}](${2:p P})") -} diff --git a/internal/lsp/testdata/snippets/literal.go b/internal/lsp/testdata/snippets/literal.go deleted file mode 100644 index 43931d18e..000000000 --- a/internal/lsp/testdata/snippets/literal.go +++ /dev/null @@ -1,22 +0,0 @@ -package snippets - -import ( - "golang.org/x/tools/internal/lsp/signature" - t "golang.org/x/tools/internal/lsp/types" -) - -type structy struct { - x signature.MyType -} - -func X(_ map[signature.Alias]t.CoolAlias) (map[signature.Alias]t.CoolAlias) { - return nil -} - -func _() { - X() //@signature(")", "X(_ map[signature.Alias]t.CoolAlias) map[signature.Alias]t.CoolAlias", 0) - _ = signature.MyType{} //@item(literalMyType, "signature.MyType{}", "", "var") - s := structy{ - x: //@snippet(" //", literalMyType, "signature.MyType{\\}", "signature.MyType{\\}") - } -}
\ No newline at end of file diff --git a/internal/lsp/testdata/snippets/literal.go.golden b/internal/lsp/testdata/snippets/literal.go.golden deleted file mode 100644 index f9725f733..000000000 --- a/internal/lsp/testdata/snippets/literal.go.golden +++ /dev/null @@ -1,6 +0,0 @@ --- X(_ map[signature.Alias]t.CoolAlias) map[signature.Alias]t.CoolAlias-signature -- -X(_ map[signature.Alias]t.CoolAlias) map[signature.Alias]t.CoolAlias - --- X(_ map[signatures.Alias]types.CoolAlias) map[signatures.Alias]types.CoolAlias-signature -- -X(_ map[signatures.Alias]types.CoolAlias) map[signatures.Alias]types.CoolAlias - diff --git a/internal/lsp/testdata/snippets/literal_snippets.go.in b/internal/lsp/testdata/snippets/literal_snippets.go.in deleted file mode 100644 index 4a2a01dfa..000000000 --- a/internal/lsp/testdata/snippets/literal_snippets.go.in +++ /dev/null @@ -1,233 +0,0 @@ -package snippets - -import ( - "bytes" - "context" - "go/ast" - "net/http" - "sort" - - "golang.org/x/tools/internal/lsp/foo" -) - -func _() { - []int{} //@item(litIntSlice, "[]int{}", "", "var") - &[]int{} //@item(litIntSliceAddr, "&[]int{}", "", "var") - make([]int, 0) //@item(makeIntSlice, "make([]int, 0)", "", "func") - - var _ *[]int = in //@snippet(" //", litIntSliceAddr, "&[]int{$0\\}", "&[]int{$0\\}") - var _ **[]int = in //@complete(" //") - - var slice []int - slice = i //@snippet(" //", litIntSlice, "[]int{$0\\}", "[]int{$0\\}") - slice = m //@snippet(" //", makeIntSlice, "make([]int, ${1:})", "make([]int, ${1:0})") -} - -func _() { - type namedInt []int - - namedInt{} //@item(litNamedSlice, "namedInt{}", "", "var") - make(namedInt, 0) //@item(makeNamedSlice, "make(namedInt, 0)", "", "func") - - var namedSlice namedInt - namedSlice = n //@snippet(" //", litNamedSlice, "namedInt{$0\\}", "namedInt{$0\\}") - namedSlice = m //@snippet(" //", makeNamedSlice, "make(namedInt, ${1:})", "make(namedInt, ${1:0})") -} - -func _() { - make(chan int) //@item(makeChan, "make(chan int)", "", "func") - - var ch chan int - ch = m //@snippet(" //", makeChan, "make(chan int)", "make(chan int)") -} - -func _() { - map[string]struct{}{} //@item(litMap, "map[string]struct{}{}", "", "var") - make(map[string]struct{}) //@item(makeMap, "make(map[string]struct{})", "", "func") - - var m map[string]struct{} - m = m //@snippet(" //", litMap, "map[string]struct{\\}{$0\\}", "map[string]struct{\\}{$0\\}") - m = m //@snippet(" //", makeMap, "make(map[string]struct{\\})", "make(map[string]struct{\\})") - - struct{}{} //@item(litEmptyStruct, "struct{}{}", "", "var") - - m["hi"] = s //@snippet(" //", litEmptyStruct, "struct{\\}{\\}", "struct{\\}{\\}") -} - -func _() { - type myStruct struct{ i int } //@item(myStructType, "myStruct", "struct{...}", "struct") - - myStruct{} //@item(litStruct, "myStruct{}", "", "var") - &myStruct{} //@item(litStructPtr, "&myStruct{}", "", "var") - - var ms myStruct - ms = m //@snippet(" //", litStruct, "myStruct{$0\\}", "myStruct{$0\\}") - - var msPtr *myStruct - msPtr = m //@snippet(" //", litStructPtr, "&myStruct{$0\\}", "&myStruct{$0\\}") - - msPtr = &m //@snippet(" //", litStruct, "myStruct{$0\\}", "myStruct{$0\\}") - - type myStructCopy struct { i int } //@item(myStructCopyType, "myStructCopy", "struct{...}", "struct") - - // Don't offer literal completion for convertible structs. - ms = myStruct //@complete(" //", litStruct, myStructType, myStructCopyType) -} - -type myImpl struct{} - -func (myImpl) foo() {} - -func (*myImpl) bar() {} - -type myBasicImpl string - -func (myBasicImpl) foo() {} - -func _() { - type myIntf interface { - foo() - } - - myImpl{} //@item(litImpl, "myImpl{}", "", "var") - - var mi myIntf - mi = m //@snippet(" //", litImpl, "myImpl{\\}", "myImpl{\\}") - - myBasicImpl() //@item(litBasicImpl, "myBasicImpl()", "string", "var") - - mi = m //@snippet(" //", litBasicImpl, "myBasicImpl($0)", "myBasicImpl($0)") - - // only satisfied by pointer to myImpl - type myPtrIntf interface { - bar() - } - - &myImpl{} //@item(litImplPtr, "&myImpl{}", "", "var") - - var mpi myPtrIntf - mpi = m //@snippet(" //", litImplPtr, "&myImpl{\\}", "&myImpl{\\}") -} - -func _() { - var s struct{ i []int } //@item(litSliceField, "i", "[]int", "field") - var foo []int - // no literal completions after selector - foo = s.i //@complete(" //", litSliceField) -} - -func _() { - type myStruct struct{ i int } //@item(litMyStructType, "myStruct", "struct{...}", "struct") - myStruct{} //@item(litMyStruct, "myStruct{}", "", "var") - - foo := func(s string, args ...myStruct) {} - // Don't give literal slice candidate for variadic arg. - // Do give literal candidates for variadic element. - foo("", myStruct) //@complete(")", litMyStruct, litMyStructType) -} - -func _() { - Buffer{} //@item(litBuffer, "Buffer{}", "", "var") - - var b *bytes.Buffer - b = bytes.Bu //@snippet(" //", litBuffer, "Buffer{\\}", "Buffer{\\}") -} - -func _() { - _ = "func(...) {}" //@item(litFunc, "func(...) {}", "", "var") - - sort.Slice(nil, fun) //@complete(")", litFunc),snippet(")", litFunc, "func(i, j int) bool {$0\\}", "func(i, j int) bool {$0\\}") - - http.HandleFunc("", f) //@snippet(")", litFunc, "func(w http.ResponseWriter, r *http.Request) {$0\\}", "func(${1:w} http.ResponseWriter, ${2:r} *http.Request) {$0\\}") - - // no literal "func" completions - http.Handle("", fun) //@complete(")") - - http.HandlerFunc() //@item(handlerFunc, "http.HandlerFunc()", "", "var") - http.Handle("", h) //@snippet(")", handlerFunc, "http.HandlerFunc($0)", "http.HandlerFunc($0)") - http.Handle("", http.HandlerFunc()) //@snippet("))", litFunc, "func(w http.ResponseWriter, r *http.Request) {$0\\}", "func(${1:w} http.ResponseWriter, ${2:r} *http.Request) {$0\\}") - - var namedReturn func(s string) (b bool) - namedReturn = f //@snippet(" //", litFunc, "func(s string) (b bool) {$0\\}", "func(s string) (b bool) {$0\\}") - - var multiReturn func() (bool, int) - multiReturn = f //@snippet(" //", litFunc, "func() (bool, int) {$0\\}", "func() (bool, int) {$0\\}") - - var multiNamedReturn func() (b bool, i int) - multiNamedReturn = f //@snippet(" //", litFunc, "func() (b bool, i int) {$0\\}", "func() (b bool, i int) {$0\\}") - - var duplicateParams func(myImpl, int, myImpl) - duplicateParams = f //@snippet(" //", litFunc, "func(mi1 myImpl, i int, mi2 myImpl) {$0\\}", "func(${1:mi1} myImpl, ${2:i} int, ${3:mi2} myImpl) {$0\\}") - - type aliasImpl = myImpl - var aliasParams func(aliasImpl) aliasImpl - aliasParams = f //@snippet(" //", litFunc, "func(ai aliasImpl) aliasImpl {$0\\}", "func(${1:ai} aliasImpl) aliasImpl {$0\\}") - - const two = 2 - var builtinTypes func([]int, [two]bool, map[string]string, struct{ i int }, interface{ foo() }, <-chan int) - builtinTypes = f //@snippet(" //", litFunc, "func(i1 []int, b [two]bool, m map[string]string, s struct{ i int \\}, i2 interface{ foo() \\}, c <-chan int) {$0\\}", "func(${1:i1} []int, ${2:b} [two]bool, ${3:m} map[string]string, ${4:s} struct{ i int \\}, ${5:i2} interface{ foo() \\}, ${6:c} <-chan int) {$0\\}") - - var _ func(ast.Node) = f //@snippet(" //", litFunc, "func(n ast.Node) {$0\\}", "func(${1:n} ast.Node) {$0\\}") - var _ func(error) = f //@snippet(" //", litFunc, "func(err error) {$0\\}", "func(${1:err} error) {$0\\}") - var _ func(context.Context) = f //@snippet(" //", litFunc, "func(ctx context.Context) {$0\\}", "func(${1:ctx} context.Context) {$0\\}") - - type context struct {} - var _ func(context) = f //@snippet(" //", litFunc, "func(ctx context) {$0\\}", "func(${1:ctx} context) {$0\\}") -} - -func _() { - StructFoo{} //@item(litStructFoo, "StructFoo{}", "struct{...}", "struct") - - var sfp *foo.StructFoo - // Don't insert the "&" before "StructFoo{}". - sfp = foo.Str //@snippet(" //", litStructFoo, "StructFoo{$0\\}", "StructFoo{$0\\}") - - var sf foo.StructFoo - sf = foo.Str //@snippet(" //", litStructFoo, "StructFoo{$0\\}", "StructFoo{$0\\}") - sf = foo. //@snippet(" //", litStructFoo, "StructFoo{$0\\}", "StructFoo{$0\\}") -} - -func _() { - float64() //@item(litFloat64, "float64()", "float64", "var") - - // don't complete to "&float64()" - var _ *float64 = float64 //@complete(" //") - - var f float64 - f = fl //@complete(" //", litFloat64),snippet(" //", litFloat64, "float64($0)", "float64($0)") - - type myInt int - myInt() //@item(litMyInt, "myInt()", "", "var") - - var mi myInt - mi = my //@snippet(" //", litMyInt, "myInt($0)", "myInt($0)") -} - -func _() { - type ptrStruct struct { - p *ptrStruct - } - - ptrStruct{} //@item(litPtrStruct, "ptrStruct{}", "", "var") - - ptrStruct{ - p: &ptrSt, //@rank(",", litPtrStruct) - } - - &ptrStruct{} //@item(litPtrStructPtr, "&ptrStruct{}", "", "var") - - &ptrStruct{ - p: ptrSt, //@rank(",", litPtrStructPtr) - } -} - -func _() { - f := func(...[]int) {} - f() //@snippet(")", litIntSlice, "[]int{$0\\}", "[]int{$0\\}") -} - - -func _() { - // don't complete to "untyped int()" - []int{}[untyped] //@complete("] //") -} diff --git a/internal/lsp/testdata/snippets/literal_snippets118.go.in b/internal/lsp/testdata/snippets/literal_snippets118.go.in deleted file mode 100644 index 8251a6384..000000000 --- a/internal/lsp/testdata/snippets/literal_snippets118.go.in +++ /dev/null @@ -1,14 +0,0 @@ -// +build go1.18 -//go:build go1.18 - -package snippets - -type Tree[T any] struct{} - -func (tree Tree[T]) Do(f func(s T)) {} - -func _() { - _ = "func(...) {}" //@item(litFunc, "func(...) {}", "", "var") - var t Tree[string] - t.Do(fun) //@complete(")", litFunc),snippet(")", litFunc, "func(s string) {$0\\}", "func(s string) {$0\\}") -} diff --git a/internal/lsp/testdata/snippets/postfix.go b/internal/lsp/testdata/snippets/postfix.go deleted file mode 100644 index d29694e83..000000000 --- a/internal/lsp/testdata/snippets/postfix.go +++ /dev/null @@ -1,42 +0,0 @@ -package snippets - -// These tests check that postfix completions do and do not show up in -// certain cases. Tests for the postfix completion contents are under -// regtest. - -func _() { - /* append! */ //@item(postfixAppend, "append!", "append and re-assign slice", "snippet") - var foo []int - foo.append //@rank(" //", postfixAppend) - - []int{}.append //@complete(" //") - - []int{}.last //@complete(" //") - - /* copy! */ //@item(postfixCopy, "copy!", "duplicate slice", "snippet") - - foo.copy //@rank(" //", postfixCopy) - - var s struct{ i []int } - s.i.copy //@rank(" //", postfixCopy) - - var _ []int = s.i.copy //@complete(" //") - - var blah func() []int - blah().append //@complete(" //") -} - -func _() { - /* append! */ //@item(postfixAppend, "append!", "append and re-assign slice", "snippet") - /* last! */ //@item(postfixLast, "last!", "s[len(s)-1]", "snippet") - /* print! */ //@item(postfixPrint, "print!", "print to stdout", "snippet") - /* range! */ //@item(postfixRange, "range!", "range over slice", "snippet") - /* reverse! */ //@item(postfixReverse, "reverse!", "reverse slice", "snippet") - /* sort! */ //@item(postfixSort, "sort!", "sort.Slice()", "snippet") - /* var! */ //@item(postfixVar, "var!", "assign to variable", "snippet") - - var foo []int - foo. //@complete(" //", postfixAppend, postfixCopy, postfixLast, postfixPrint, postfixRange, postfixReverse, postfixSort, postfixVar) - - foo = nil -} diff --git a/internal/lsp/testdata/snippets/snippets.go.golden b/internal/lsp/testdata/snippets/snippets.go.golden deleted file mode 100644 index 3f20ba50b..000000000 --- a/internal/lsp/testdata/snippets/snippets.go.golden +++ /dev/null @@ -1,3 +0,0 @@ --- baz(at AliasType, b bool)-signature -- -baz(at AliasType, b bool) - diff --git a/internal/lsp/testdata/snippets/snippets.go.in b/internal/lsp/testdata/snippets/snippets.go.in deleted file mode 100644 index 58150c644..000000000 --- a/internal/lsp/testdata/snippets/snippets.go.in +++ /dev/null @@ -1,61 +0,0 @@ -package snippets - -type AliasType = int //@item(sigAliasType, "AliasType", "AliasType", "type") - -func foo(i int, b bool) {} //@item(snipFoo, "foo", "func(i int, b bool)", "func") -func bar(fn func()) func() {} //@item(snipBar, "bar", "func(fn func())", "func") -func baz(at AliasType, b bool) {} //@item(snipBaz, "baz", "func(at AliasType, b bool)", "func") - -type Foo struct { - Bar int //@item(snipFieldBar, "Bar", "int", "field") - Func func(at AliasType) error //@item(snipFieldFunc, "Func", "func(at AliasType) error", "field") -} - -func (Foo) Baz() func() {} //@item(snipMethodBaz, "Baz", "func() func()", "method") -func (Foo) BazBar() func() {} //@item(snipMethodBazBar, "BazBar", "func() func()", "method") -func (Foo) BazBaz(at AliasType) func() {} //@item(snipMethodBazBaz, "BazBaz", "func(at AliasType) func()", "method") - -func _() { - f //@snippet(" //", snipFoo, "foo(${1:})", "foo(${1:i int}, ${2:b bool})") - - bar //@snippet(" //", snipBar, "bar(${1:})", "bar(${1:fn func()})") - - baz //@snippet(" //", snipBaz, "baz(${1:})", "baz(${1:at AliasType}, ${2:b bool})") - baz() //@signature("(", "baz(at AliasType, b bool)", 0) - - bar(nil) //@snippet("(", snipBar, "bar", "bar") - bar(ba) //@snippet(")", snipBar, "bar(${1:})", "bar(${1:fn func()})") - var f Foo - bar(f.Ba) //@snippet(")", snipMethodBaz, "Baz()", "Baz()") - (bar)(nil) //@snippet(")", snipBar, "bar(${1:})", "bar(${1:fn func()})") - (f.Ba)() //@snippet(")", snipMethodBaz, "Baz()", "Baz()") - - Foo{ - B //@snippet(" //", snipFieldBar, "Bar: ${1:},", "Bar: ${1:int},") - } - - Foo{ - F //@snippet(" //", snipFieldFunc, "Func: ${1:},", "Func: ${1:func(at AliasType) error},") - } - - Foo{B} //@snippet("}", snipFieldBar, "Bar: ${1:}", "Bar: ${1:int}") - Foo{} //@snippet("}", snipFieldBar, "Bar: ${1:}", "Bar: ${1:int}") - - Foo{Foo{}.B} //@snippet("} ", snipFieldBar, "Bar", "Bar") - - var err error - err.Error() //@snippet("E", Error, "Error()", "Error()") - f.Baz() //@snippet("B", snipMethodBaz, "Baz()", "Baz()") - - f.Baz() //@snippet("(", snipMethodBazBar, "BazBar", "BazBar") - - f.Baz() //@snippet("B", snipMethodBazBaz, "BazBaz(${1:})", "BazBaz(${1:at AliasType})") -} - -func _() { - type bar struct { - a int - b float64 //@item(snipBarB, "b", "float64", "field") - } - bar{b} //@snippet("}", snipBarB, "b: ${1:}", "b: ${1:float64}") -} diff --git a/internal/lsp/testdata/statements/append.go b/internal/lsp/testdata/statements/append.go deleted file mode 100644 index 0eea85a28..000000000 --- a/internal/lsp/testdata/statements/append.go +++ /dev/null @@ -1,42 +0,0 @@ -package statements - -func _() { - type mySlice []int - - var ( - abc []int //@item(stmtABC, "abc", "[]int", "var") - abcdef mySlice //@item(stmtABCDEF, "abcdef", "mySlice", "var") - ) - - /* abcdef = append(abcdef, ) */ //@item(stmtABCDEFAssignAppend, "abcdef = append(abcdef, )", "", "func") - - // don't offer "abc = append(abc, )" because "abc" isn't necessarily - // better than "abcdef". - abc //@complete(" //", stmtABC, stmtABCDEF) - - abcdef //@complete(" //", stmtABCDEF, stmtABCDEFAssignAppend) - - /* append(abc, ) */ //@item(stmtABCAppend, "append(abc, )", "", "func") - - abc = app //@snippet(" //", stmtABCAppend, "append(abc, ${1:})", "append(abc, ${1:})") -} - -func _() { - var s struct{ xyz []int } - - /* xyz = append(s.xyz, ) */ //@item(stmtXYZAppend, "xyz = append(s.xyz, )", "", "func") - - s.x //@snippet(" //", stmtXYZAppend, "xyz = append(s.xyz, ${1:})", "xyz = append(s.xyz, ${1:})") - - /* s.xyz = append(s.xyz, ) */ //@item(stmtDeepXYZAppend, "s.xyz = append(s.xyz, )", "", "func") - - sx //@snippet(" //", stmtDeepXYZAppend, "s.xyz = append(s.xyz, ${1:})", "s.xyz = append(s.xyz, ${1:})") -} - -func _() { - var foo [][]int - - /* append(foo[0], ) */ //@item(stmtFooAppend, "append(foo[0], )", "", "func") - - foo[0] = app //@complete(" //"),snippet(" //", stmtFooAppend, "append(foo[0], ${1:})", "append(foo[0], ${1:})") -} diff --git a/internal/lsp/testdata/statements/if_err_check_return.go b/internal/lsp/testdata/statements/if_err_check_return.go deleted file mode 100644 index e82b78333..000000000 --- a/internal/lsp/testdata/statements/if_err_check_return.go +++ /dev/null @@ -1,27 +0,0 @@ -package statements - -import ( - "bytes" - "io" - "os" -) - -func one() (int, float32, io.Writer, *int, []int, bytes.Buffer, error) { - /* if err != nil { return err } */ //@item(stmtOneIfErrReturn, "if err != nil { return err }", "", "") - /* err != nil { return err } */ //@item(stmtOneErrReturn, "err != nil { return err }", "", "") - - _, err := os.Open("foo") - //@snippet("", stmtOneIfErrReturn, "", "if err != nil {\n\treturn 0, 0, nil, nil, nil, bytes.Buffer{\\}, ${1:err}\n\\}") - - _, err = os.Open("foo") - i //@snippet(" //", stmtOneIfErrReturn, "", "if err != nil {\n\treturn 0, 0, nil, nil, nil, bytes.Buffer{\\}, ${1:err}\n\\}") - - _, err = os.Open("foo") - if er //@snippet(" //", stmtOneErrReturn, "", "err != nil {\n\treturn 0, 0, nil, nil, nil, bytes.Buffer{\\}, ${1:err}\n\\}") - - _, err = os.Open("foo") - if //@snippet(" //", stmtOneIfErrReturn, "", "if err != nil {\n\treturn 0, 0, nil, nil, nil, bytes.Buffer{\\}, ${1:err}\n\\}") - - _, err = os.Open("foo") - if //@snippet("//", stmtOneIfErrReturn, "", "if err != nil {\n\treturn 0, 0, nil, nil, nil, bytes.Buffer{\\}, ${1:err}\n\\}") -} diff --git a/internal/lsp/testdata/statements/if_err_check_return_2.go b/internal/lsp/testdata/statements/if_err_check_return_2.go deleted file mode 100644 index e2dce804f..000000000 --- a/internal/lsp/testdata/statements/if_err_check_return_2.go +++ /dev/null @@ -1,12 +0,0 @@ -package statements - -import "os" - -func two() error { - var s struct{ err error } - - /* if s.err != nil { return s.err } */ //@item(stmtTwoIfErrReturn, "if s.err != nil { return s.err }", "", "") - - _, s.err = os.Open("foo") - //@snippet("", stmtTwoIfErrReturn, "", "if s.err != nil {\n\treturn ${1:s.err}\n\\}") -} diff --git a/internal/lsp/testdata/statements/if_err_check_test.go b/internal/lsp/testdata/statements/if_err_check_test.go deleted file mode 100644 index 6de587879..000000000 --- a/internal/lsp/testdata/statements/if_err_check_test.go +++ /dev/null @@ -1,20 +0,0 @@ -package statements - -import ( - "os" - "testing" -) - -func TestErr(t *testing.T) { - /* if err != nil { t.Fatal(err) } */ //@item(stmtOneIfErrTFatal, "if err != nil { t.Fatal(err) }", "", "") - - _, err := os.Open("foo") - //@snippet("", stmtOneIfErrTFatal, "", "if err != nil {\n\tt.Fatal(err)\n\\}") -} - -func BenchmarkErr(b *testing.B) { - /* if err != nil { b.Fatal(err) } */ //@item(stmtOneIfErrBFatal, "if err != nil { b.Fatal(err) }", "", "") - - _, err := os.Open("foo") - //@snippet("", stmtOneIfErrBFatal, "", "if err != nil {\n\tb.Fatal(err)\n\\}") -} diff --git a/internal/lsp/testdata/stub/other/other.go b/internal/lsp/testdata/stub/other/other.go deleted file mode 100644 index ba3c1747a..000000000 --- a/internal/lsp/testdata/stub/other/other.go +++ /dev/null @@ -1,10 +0,0 @@ -package other - -import ( - "bytes" - renamed_context "context" -) - -type Interface interface { - Get(renamed_context.Context) *bytes.Buffer -} diff --git a/internal/lsp/testdata/stub/stub_add_selector.go b/internal/lsp/testdata/stub/stub_add_selector.go deleted file mode 100644 index a15afd7c2..000000000 --- a/internal/lsp/testdata/stub/stub_add_selector.go +++ /dev/null @@ -1,12 +0,0 @@ -package stub - -import "io" - -// This file tests that if an interface -// method references a type from its own package -// then our implementation must add the import/package selector -// in the concrete method if the concrete type is outside of the interface -// package -var _ io.ReaderFrom = &readerFrom{} //@suggestedfix("&readerFrom", "refactor.rewrite") - -type readerFrom struct{} diff --git a/internal/lsp/testdata/stub/stub_add_selector.go.golden b/internal/lsp/testdata/stub/stub_add_selector.go.golden deleted file mode 100644 index e885483ea..000000000 --- a/internal/lsp/testdata/stub/stub_add_selector.go.golden +++ /dev/null @@ -1,19 +0,0 @@ --- suggestedfix_stub_add_selector_10_23 -- -package stub - -import "io" - -// This file tests that if an interface -// method references a type from its own package -// then our implementation must add the import/package selector -// in the concrete method if the concrete type is outside of the interface -// package -var _ io.ReaderFrom = &readerFrom{} //@suggestedfix("&readerFrom", "refactor.rewrite") - -type readerFrom struct{} - -// ReadFrom implements io.ReaderFrom -func (*readerFrom) ReadFrom(r io.Reader) (n int64, err error) { - panic("unimplemented") -} - diff --git a/internal/lsp/testdata/stub/stub_assign.go b/internal/lsp/testdata/stub/stub_assign.go deleted file mode 100644 index 9336361d0..000000000 --- a/internal/lsp/testdata/stub/stub_assign.go +++ /dev/null @@ -1,10 +0,0 @@ -package stub - -import "io" - -func main() { - var br io.ByteWriter - br = &byteWriter{} //@suggestedfix("&", "refactor.rewrite") -} - -type byteWriter struct{} diff --git a/internal/lsp/testdata/stub/stub_assign.go.golden b/internal/lsp/testdata/stub/stub_assign.go.golden deleted file mode 100644 index a52a82367..000000000 --- a/internal/lsp/testdata/stub/stub_assign.go.golden +++ /dev/null @@ -1,17 +0,0 @@ --- suggestedfix_stub_assign_7_7 -- -package stub - -import "io" - -func main() { - var br io.ByteWriter - br = &byteWriter{} //@suggestedfix("&", "refactor.rewrite") -} - -type byteWriter struct{} - -// WriteByte implements io.ByteWriter -func (*byteWriter) WriteByte(c byte) error { - panic("unimplemented") -} - diff --git a/internal/lsp/testdata/stub/stub_assign_multivars.go b/internal/lsp/testdata/stub/stub_assign_multivars.go deleted file mode 100644 index 01b330fda..000000000 --- a/internal/lsp/testdata/stub/stub_assign_multivars.go +++ /dev/null @@ -1,11 +0,0 @@ -package stub - -import "io" - -func main() { - var br io.ByteWriter - var i int - i, br = 1, &multiByteWriter{} //@suggestedfix("&", "refactor.rewrite") -} - -type multiByteWriter struct{} diff --git a/internal/lsp/testdata/stub/stub_assign_multivars.go.golden b/internal/lsp/testdata/stub/stub_assign_multivars.go.golden deleted file mode 100644 index e1e71adbd..000000000 --- a/internal/lsp/testdata/stub/stub_assign_multivars.go.golden +++ /dev/null @@ -1,18 +0,0 @@ --- suggestedfix_stub_assign_multivars_8_13 -- -package stub - -import "io" - -func main() { - var br io.ByteWriter - var i int - i, br = 1, &multiByteWriter{} //@suggestedfix("&", "refactor.rewrite") -} - -type multiByteWriter struct{} - -// WriteByte implements io.ByteWriter -func (*multiByteWriter) WriteByte(c byte) error { - panic("unimplemented") -} - diff --git a/internal/lsp/testdata/stub/stub_embedded.go b/internal/lsp/testdata/stub/stub_embedded.go deleted file mode 100644 index 6d6a986bf..000000000 --- a/internal/lsp/testdata/stub/stub_embedded.go +++ /dev/null @@ -1,15 +0,0 @@ -package stub - -import ( - "io" - "sort" -) - -var _ embeddedInterface = (*embeddedConcrete)(nil) //@suggestedfix("(", "refactor.rewrite") - -type embeddedConcrete struct{} - -type embeddedInterface interface { - sort.Interface - io.Reader -} diff --git a/internal/lsp/testdata/stub/stub_embedded.go.golden b/internal/lsp/testdata/stub/stub_embedded.go.golden deleted file mode 100644 index c258ebaf4..000000000 --- a/internal/lsp/testdata/stub/stub_embedded.go.golden +++ /dev/null @@ -1,37 +0,0 @@ --- suggestedfix_stub_embedded_8_27 -- -package stub - -import ( - "io" - "sort" -) - -var _ embeddedInterface = (*embeddedConcrete)(nil) //@suggestedfix("(", "refactor.rewrite") - -type embeddedConcrete struct{} - -// Len implements embeddedInterface -func (*embeddedConcrete) Len() int { - panic("unimplemented") -} - -// Less implements embeddedInterface -func (*embeddedConcrete) Less(i int, j int) bool { - panic("unimplemented") -} - -// Swap implements embeddedInterface -func (*embeddedConcrete) Swap(i int, j int) { - panic("unimplemented") -} - -// Read implements embeddedInterface -func (*embeddedConcrete) Read(p []byte) (n int, err error) { - panic("unimplemented") -} - -type embeddedInterface interface { - sort.Interface - io.Reader -} - diff --git a/internal/lsp/testdata/stub/stub_err.go b/internal/lsp/testdata/stub/stub_err.go deleted file mode 100644 index 908c7d315..000000000 --- a/internal/lsp/testdata/stub/stub_err.go +++ /dev/null @@ -1,7 +0,0 @@ -package stub - -func main() { - var br error = &customErr{} //@suggestedfix("&", "refactor.rewrite") -} - -type customErr struct{} diff --git a/internal/lsp/testdata/stub/stub_err.go.golden b/internal/lsp/testdata/stub/stub_err.go.golden deleted file mode 100644 index 717aed862..000000000 --- a/internal/lsp/testdata/stub/stub_err.go.golden +++ /dev/null @@ -1,14 +0,0 @@ --- suggestedfix_stub_err_4_17 -- -package stub - -func main() { - var br error = &customErr{} //@suggestedfix("&", "refactor.rewrite") -} - -type customErr struct{} - -// Error implements error -func (*customErr) Error() string { - panic("unimplemented") -} - diff --git a/internal/lsp/testdata/stub/stub_function_return.go b/internal/lsp/testdata/stub/stub_function_return.go deleted file mode 100644 index bbf05885a..000000000 --- a/internal/lsp/testdata/stub/stub_function_return.go +++ /dev/null @@ -1,11 +0,0 @@ -package stub - -import ( - "io" -) - -func newCloser() io.Closer { - return closer{} //@suggestedfix("c", "refactor.rewrite") -} - -type closer struct{} diff --git a/internal/lsp/testdata/stub/stub_function_return.go.golden b/internal/lsp/testdata/stub/stub_function_return.go.golden deleted file mode 100644 index f80874d2b..000000000 --- a/internal/lsp/testdata/stub/stub_function_return.go.golden +++ /dev/null @@ -1,18 +0,0 @@ --- suggestedfix_stub_function_return_8_9 -- -package stub - -import ( - "io" -) - -func newCloser() io.Closer { - return closer{} //@suggestedfix("c", "refactor.rewrite") -} - -type closer struct{} - -// Close implements io.Closer -func (closer) Close() error { - panic("unimplemented") -} - diff --git a/internal/lsp/testdata/stub/stub_generic_receiver.go b/internal/lsp/testdata/stub/stub_generic_receiver.go deleted file mode 100644 index 64e90fcf6..000000000 --- a/internal/lsp/testdata/stub/stub_generic_receiver.go +++ /dev/null @@ -1,15 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -package stub - -import "io" - -// This file tests that that the stub method generator accounts for concrete -// types that have type parameters defined. -var _ io.ReaderFrom = &genReader[string, int]{} //@suggestedfix("&genReader", "refactor.rewrite") - -type genReader[T, Y any] struct { - T T - Y Y -} diff --git a/internal/lsp/testdata/stub/stub_generic_receiver.go.golden b/internal/lsp/testdata/stub/stub_generic_receiver.go.golden deleted file mode 100644 index 1fc7157b4..000000000 --- a/internal/lsp/testdata/stub/stub_generic_receiver.go.golden +++ /dev/null @@ -1,22 +0,0 @@ --- suggestedfix_stub_generic_receiver_10_23 -- -//go:build go1.18 -// +build go1.18 - -package stub - -import "io" - -// This file tests that that the stub method generator accounts for concrete -// types that have type parameters defined. -var _ io.ReaderFrom = &genReader[string, int]{} //@suggestedfix("&genReader", "refactor.rewrite") - -type genReader[T, Y any] struct { - T T - Y Y -} - -// ReadFrom implements io.ReaderFrom -func (*genReader[T, Y]) ReadFrom(r io.Reader) (n int64, err error) { - panic("unimplemented") -} - diff --git a/internal/lsp/testdata/stub/stub_ignored_imports.go b/internal/lsp/testdata/stub/stub_ignored_imports.go deleted file mode 100644 index 8f6ec73de..000000000 --- a/internal/lsp/testdata/stub/stub_ignored_imports.go +++ /dev/null @@ -1,18 +0,0 @@ -package stub - -import ( - "compress/zlib" - . "io" - _ "io" -) - -// This file tests that dot-imports and underscore imports -// are properly ignored and that a new import is added to -// reference method types - -var ( - _ Reader - _ zlib.Resetter = (*ignoredResetter)(nil) //@suggestedfix("(", "refactor.rewrite") -) - -type ignoredResetter struct{} diff --git a/internal/lsp/testdata/stub/stub_ignored_imports.go.golden b/internal/lsp/testdata/stub/stub_ignored_imports.go.golden deleted file mode 100644 index a0ddc1793..000000000 --- a/internal/lsp/testdata/stub/stub_ignored_imports.go.golden +++ /dev/null @@ -1,26 +0,0 @@ --- suggestedfix_stub_ignored_imports_15_20 -- -package stub - -import ( - "compress/zlib" - "io" - . "io" - _ "io" -) - -// This file tests that dot-imports and underscore imports -// are properly ignored and that a new import is added to -// reference method types - -var ( - _ Reader - _ zlib.Resetter = (*ignoredResetter)(nil) //@suggestedfix("(", "refactor.rewrite") -) - -type ignoredResetter struct{} - -// Reset implements zlib.Resetter -func (*ignoredResetter) Reset(r io.Reader, dict []byte) error { - panic("unimplemented") -} - diff --git a/internal/lsp/testdata/stub/stub_multi_var.go b/internal/lsp/testdata/stub/stub_multi_var.go deleted file mode 100644 index 4276b7994..000000000 --- a/internal/lsp/testdata/stub/stub_multi_var.go +++ /dev/null @@ -1,11 +0,0 @@ -package stub - -import "io" - -// This test ensures that a variable declaration that -// has multiple values on the same line can still be -// analyzed correctly to target the interface implementation -// diagnostic. -var one, two, three io.Reader = nil, &multiVar{}, nil //@suggestedfix("&", "refactor.rewrite") - -type multiVar struct{} diff --git a/internal/lsp/testdata/stub/stub_multi_var.go.golden b/internal/lsp/testdata/stub/stub_multi_var.go.golden deleted file mode 100644 index b9ac42367..000000000 --- a/internal/lsp/testdata/stub/stub_multi_var.go.golden +++ /dev/null @@ -1,18 +0,0 @@ --- suggestedfix_stub_multi_var_9_38 -- -package stub - -import "io" - -// This test ensures that a variable declaration that -// has multiple values on the same line can still be -// analyzed correctly to target the interface implementation -// diagnostic. -var one, two, three io.Reader = nil, &multiVar{}, nil //@suggestedfix("&", "refactor.rewrite") - -type multiVar struct{} - -// Read implements io.Reader -func (*multiVar) Read(p []byte) (n int, err error) { - panic("unimplemented") -} - diff --git a/internal/lsp/testdata/stub/stub_pointer.go b/internal/lsp/testdata/stub/stub_pointer.go deleted file mode 100644 index 2b3681b83..000000000 --- a/internal/lsp/testdata/stub/stub_pointer.go +++ /dev/null @@ -1,9 +0,0 @@ -package stub - -import "io" - -func getReaderFrom() io.ReaderFrom { - return &pointerImpl{} //@suggestedfix("&", "refactor.rewrite") -} - -type pointerImpl struct{} diff --git a/internal/lsp/testdata/stub/stub_pointer.go.golden b/internal/lsp/testdata/stub/stub_pointer.go.golden deleted file mode 100644 index c4133d7a4..000000000 --- a/internal/lsp/testdata/stub/stub_pointer.go.golden +++ /dev/null @@ -1,16 +0,0 @@ --- suggestedfix_stub_pointer_6_9 -- -package stub - -import "io" - -func getReaderFrom() io.ReaderFrom { - return &pointerImpl{} //@suggestedfix("&", "refactor.rewrite") -} - -type pointerImpl struct{} - -// ReadFrom implements io.ReaderFrom -func (*pointerImpl) ReadFrom(r io.Reader) (n int64, err error) { - panic("unimplemented") -} - diff --git a/internal/lsp/testdata/stub/stub_renamed_import.go b/internal/lsp/testdata/stub/stub_renamed_import.go deleted file mode 100644 index eaebe2510..000000000 --- a/internal/lsp/testdata/stub/stub_renamed_import.go +++ /dev/null @@ -1,11 +0,0 @@ -package stub - -import ( - "compress/zlib" - myio "io" -) - -var _ zlib.Resetter = &myIO{} //@suggestedfix("&", "refactor.rewrite") -var _ myio.Reader - -type myIO struct{} diff --git a/internal/lsp/testdata/stub/stub_renamed_import.go.golden b/internal/lsp/testdata/stub/stub_renamed_import.go.golden deleted file mode 100644 index 48ff4f153..000000000 --- a/internal/lsp/testdata/stub/stub_renamed_import.go.golden +++ /dev/null @@ -1,18 +0,0 @@ --- suggestedfix_stub_renamed_import_8_23 -- -package stub - -import ( - "compress/zlib" - myio "io" -) - -var _ zlib.Resetter = &myIO{} //@suggestedfix("&", "refactor.rewrite") -var _ myio.Reader - -type myIO struct{} - -// Reset implements zlib.Resetter -func (*myIO) Reset(r myio.Reader, dict []byte) error { - panic("unimplemented") -} - diff --git a/internal/lsp/testdata/stub/stub_renamed_import_iface.go b/internal/lsp/testdata/stub/stub_renamed_import_iface.go deleted file mode 100644 index 96caf540d..000000000 --- a/internal/lsp/testdata/stub/stub_renamed_import_iface.go +++ /dev/null @@ -1,13 +0,0 @@ -package stub - -import ( - "golang.org/x/tools/internal/lsp/stub/other" -) - -// This file tests that if an interface -// method references an import from its own package -// that the concrete type does not yet import, and that import happens -// to be renamed, then we prefer the renaming of the interface. -var _ other.Interface = &otherInterfaceImpl{} //@suggestedfix("&otherInterfaceImpl", "refactor.rewrite") - -type otherInterfaceImpl struct{} diff --git a/internal/lsp/testdata/stub/stub_renamed_import_iface.go.golden b/internal/lsp/testdata/stub/stub_renamed_import_iface.go.golden deleted file mode 100644 index 9ba2cb440..000000000 --- a/internal/lsp/testdata/stub/stub_renamed_import_iface.go.golden +++ /dev/null @@ -1,22 +0,0 @@ --- suggestedfix_stub_renamed_import_iface_11_25 -- -package stub - -import ( - "bytes" - renamed_context "context" - "golang.org/x/tools/internal/lsp/stub/other" -) - -// This file tests that if an interface -// method references an import from its own package -// that the concrete type does not yet import, and that import happens -// to be renamed, then we prefer the renaming of the interface. -var _ other.Interface = &otherInterfaceImpl{} //@suggestedfix("&otherInterfaceImpl", "refactor.rewrite") - -type otherInterfaceImpl struct{} - -// Get implements other.Interface -func (*otherInterfaceImpl) Get(renamed_context.Context) *bytes.Buffer { - panic("unimplemented") -} - diff --git a/internal/lsp/testdata/stub/stub_stdlib.go b/internal/lsp/testdata/stub/stub_stdlib.go deleted file mode 100644 index 0d54a6daa..000000000 --- a/internal/lsp/testdata/stub/stub_stdlib.go +++ /dev/null @@ -1,9 +0,0 @@ -package stub - -import ( - "io" -) - -var _ io.Writer = writer{} //@suggestedfix("w", "refactor.rewrite") - -type writer struct{} diff --git a/internal/lsp/testdata/stub/stub_stdlib.go.golden b/internal/lsp/testdata/stub/stub_stdlib.go.golden deleted file mode 100644 index 8636cead4..000000000 --- a/internal/lsp/testdata/stub/stub_stdlib.go.golden +++ /dev/null @@ -1,16 +0,0 @@ --- suggestedfix_stub_stdlib_7_19 -- -package stub - -import ( - "io" -) - -var _ io.Writer = writer{} //@suggestedfix("w", "refactor.rewrite") - -type writer struct{} - -// Write implements io.Writer -func (writer) Write(p []byte) (n int, err error) { - panic("unimplemented") -} - diff --git a/internal/lsp/testdata/suggestedfix/has_suggested_fix.go b/internal/lsp/testdata/suggestedfix/has_suggested_fix.go deleted file mode 100644 index e06dce0a8..000000000 --- a/internal/lsp/testdata/suggestedfix/has_suggested_fix.go +++ /dev/null @@ -1,11 +0,0 @@ -package suggestedfix - -import ( - "log" -) - -func goodbye() { - s := "hiiiiiii" - s = s //@suggestedfix("s = s", "quickfix") - log.Print(s) -} diff --git a/internal/lsp/testdata/suggestedfix/has_suggested_fix.go.golden b/internal/lsp/testdata/suggestedfix/has_suggested_fix.go.golden deleted file mode 100644 index 9ccaa1994..000000000 --- a/internal/lsp/testdata/suggestedfix/has_suggested_fix.go.golden +++ /dev/null @@ -1,13 +0,0 @@ --- suggestedfix_has_suggested_fix_9_2 -- -package suggestedfix - -import ( - "log" -) - -func goodbye() { - s := "hiiiiiii" - //@suggestedfix("s = s", "quickfix") - log.Print(s) -} - diff --git a/internal/lsp/testdata/summary.txt.golden b/internal/lsp/testdata/summary.txt.golden deleted file mode 100644 index 29493920f..000000000 --- a/internal/lsp/testdata/summary.txt.golden +++ /dev/null @@ -1,30 +0,0 @@ --- summary -- -CallHierarchyCount = 2 -CodeLensCount = 5 -CompletionsCount = 265 -CompletionSnippetCount = 106 -UnimportedCompletionsCount = 5 -DeepCompletionsCount = 5 -FuzzyCompletionsCount = 8 -RankedCompletionsCount = 163 -CaseSensitiveCompletionsCount = 4 -DiagnosticsCount = 37 -FoldingRangesCount = 2 -FormatCount = 6 -ImportCount = 8 -SemanticTokenCount = 3 -SuggestedFixCount = 61 -FunctionExtractionCount = 25 -MethodExtractionCount = 6 -DefinitionsCount = 95 -TypeDefinitionsCount = 18 -HighlightsCount = 69 -ReferencesCount = 27 -RenamesCount = 41 -PrepareRenamesCount = 7 -SymbolsCount = 5 -WorkspaceSymbolsCount = 20 -SignaturesCount = 33 -LinksCount = 7 -ImplementationsCount = 14 - diff --git a/internal/lsp/testdata/summary_go1.18.txt.golden b/internal/lsp/testdata/summary_go1.18.txt.golden deleted file mode 100644 index 48639899e..000000000 --- a/internal/lsp/testdata/summary_go1.18.txt.golden +++ /dev/null @@ -1,30 +0,0 @@ --- summary -- -CallHierarchyCount = 2 -CodeLensCount = 5 -CompletionsCount = 266 -CompletionSnippetCount = 110 -UnimportedCompletionsCount = 5 -DeepCompletionsCount = 5 -FuzzyCompletionsCount = 8 -RankedCompletionsCount = 169 -CaseSensitiveCompletionsCount = 4 -DiagnosticsCount = 37 -FoldingRangesCount = 2 -FormatCount = 6 -ImportCount = 8 -SemanticTokenCount = 3 -SuggestedFixCount = 62 -FunctionExtractionCount = 25 -MethodExtractionCount = 6 -DefinitionsCount = 108 -TypeDefinitionsCount = 18 -HighlightsCount = 69 -ReferencesCount = 27 -RenamesCount = 48 -PrepareRenamesCount = 7 -SymbolsCount = 5 -WorkspaceSymbolsCount = 20 -SignaturesCount = 33 -LinksCount = 7 -ImplementationsCount = 14 - diff --git a/internal/lsp/testdata/symbols/main.go b/internal/lsp/testdata/symbols/main.go deleted file mode 100644 index 8111250f3..000000000 --- a/internal/lsp/testdata/symbols/main.go +++ /dev/null @@ -1,64 +0,0 @@ -package main - -import ( - "io" -) - -var _ = 1 - -var x = 42 //@mark(symbolsx, "x"), symbol("x", "x", "Variable", "", "main.x") - -const y = 43 //@symbol("y", "y", "Constant", "", "main.y") - -type Number int //@symbol("Number", "Number", "Number", "", "main.Number") - -type Alias = string //@symbol("Alias", "Alias", "String", "", "main.Alias") - -type NumberAlias = Number //@symbol("NumberAlias", "NumberAlias", "Number", "", "main.NumberAlias") - -type ( - Boolean bool //@symbol("Boolean", "Boolean", "Boolean", "", "main.Boolean") - BoolAlias = bool //@symbol("BoolAlias", "BoolAlias", "Boolean", "", "main.BoolAlias") -) - -type Foo struct { //@mark(symbolsFoo, "Foo"), symbol("Foo", "Foo", "Struct", "", "main.Foo") - Quux //@mark(fQuux, "Quux"), symbol("Quux", "Quux", "Field", "Foo", "main.Foo.Quux") - W io.Writer //@symbol("W" , "W", "Field", "Foo", "main.Foo.W") - Bar int //@mark(fBar, "Bar"), symbol("Bar", "Bar", "Field", "Foo", "main.Foo.Bar") - baz string //@symbol("baz", "baz", "Field", "Foo", "main.Foo.baz") -} - -type Quux struct { //@symbol("Quux", "Quux", "Struct", "", "main.Quux") - X, Y float64 //@mark(qX, "X"), symbol("X", "X", "Field", "Quux", "main.X"), symbol("Y", "Y", "Field", "Quux", "main.Y") -} - -func (f Foo) Baz() string { //@symbol("(Foo).Baz", "Baz", "Method", "", "main.Foo.Baz") - return f.baz -} - -func _() {} - -func (q *Quux) Do() {} //@mark(qDo, "Do"), symbol("(*Quux).Do", "Do", "Method", "", "main.Quux.Do") - -func main() { //@symbol("main", "main", "Function", "", "main.main") - -} - -type Stringer interface { //@symbol("Stringer", "Stringer", "Interface", "", "main.Stringer") - String() string //@symbol("String", "String", "Method", "Stringer", "main.Stringer.String") -} - -type ABer interface { //@mark(ABerInterface, "ABer"), symbol("ABer", "ABer", "Interface", "", "main.ABer") - B() //@symbol("B", "B", "Method", "ABer", "main.ABer.B") - A() string //@mark(ABerA, "A"), symbol("A", "A", "Method", "ABer", "main.ABer.A") -} - -type WithEmbeddeds interface { //@symbol("WithEmbeddeds", "WithEmbeddeds", "Interface", "", "main.WithEmbeddeds") - Do() //@symbol("Do", "Do", "Method", "WithEmbeddeds", "main.WithEmbeddeds.Do") - ABer //@symbol("ABer", "ABer", "Interface", "WithEmbeddeds", "main.WithEmbeddeds.ABer") - io.Writer //@mark(ioWriter, "io.Writer"), symbol("io.Writer", "io.Writer", "Interface", "WithEmbeddeds", "main.WithEmbeddeds.Writer") -} - -func Dunk() int { return 0 } //@symbol("Dunk", "Dunk", "Function", "", "main.Dunk") - -func dunk() {} //@symbol("dunk", "dunk", "Function", "", "main.dunk") diff --git a/internal/lsp/testdata/symbols/main.go.golden b/internal/lsp/testdata/symbols/main.go.golden deleted file mode 100644 index ebb6a8a5d..000000000 --- a/internal/lsp/testdata/symbols/main.go.golden +++ /dev/null @@ -1,31 +0,0 @@ --- symbols -- -x Variable 9:5-9:6 -y Constant 11:7-11:8 -Number Number 13:6-13:12 -Alias String 15:6-15:11 -NumberAlias Number 17:6-17:17 -Boolean Boolean 20:2-20:9 -BoolAlias Boolean 21:2-21:11 -Foo Struct 24:6-24:9 - Bar Field 27:2-27:5 - Quux Field 25:2-25:6 - W Field 26:2-26:3 - baz Field 28:2-28:5 -Quux Struct 31:6-31:10 - X Field 32:2-32:3 - Y Field 32:5-32:6 -(Foo).Baz Method 35:14-35:17 -(*Quux).Do Method 41:16-41:18 -main Function 43:6-43:10 -Stringer Interface 47:6-47:14 - String Method 48:2-48:8 -ABer Interface 51:6-51:10 - A Method 53:2-53:3 - B Method 52:2-52:3 -WithEmbeddeds Interface 56:6-56:19 - ABer Interface 58:2-58:6 - Do Method 57:2-57:4 - io.Writer Interface 59:2-59:11 -Dunk Function 62:6-62:10 -dunk Function 64:6-64:10 - diff --git a/internal/lsp/testdata/testy/testy.go b/internal/lsp/testdata/testy/testy.go deleted file mode 100644 index 1a738d7d7..000000000 --- a/internal/lsp/testdata/testy/testy.go +++ /dev/null @@ -1,5 +0,0 @@ -package testy - -func a() { //@mark(identA, "a"),item(funcA, "a", "func()", "func"),refs("a", identA, testyA) - //@complete("", funcA) -} diff --git a/internal/lsp/testdata/testy/testy_test.go b/internal/lsp/testdata/testy/testy_test.go deleted file mode 100644 index 4939f86b5..000000000 --- a/internal/lsp/testdata/testy/testy_test.go +++ /dev/null @@ -1,18 +0,0 @@ -package testy - -import ( - "testing" - - sig "golang.org/x/tools/internal/lsp/signature" - "golang.org/x/tools/internal/lsp/snippets" -) - -func TestSomething(t *testing.T) { //@item(TestSomething, "TestSomething(t *testing.T)", "", "func") - var x int //@mark(testyX, "x"),diag("x", "compiler", "x declared but not used", "error"),refs("x", testyX) - a() //@mark(testyA, "a") -} - -func _() { - _ = snippets.X(nil) //@signature("nil", "X(_ map[sig.Alias]types.CoolAlias) map[sig.Alias]types.CoolAlias", 0) - var _ sig.Alias -} diff --git a/internal/lsp/testdata/testy/testy_test.go.golden b/internal/lsp/testdata/testy/testy_test.go.golden deleted file mode 100644 index cafc380d0..000000000 --- a/internal/lsp/testdata/testy/testy_test.go.golden +++ /dev/null @@ -1,3 +0,0 @@ --- X(_ map[sig.Alias]types.CoolAlias) map[sig.Alias]types.CoolAlias-signature -- -X(_ map[sig.Alias]types.CoolAlias) map[sig.Alias]types.CoolAlias - diff --git a/internal/lsp/testdata/typdef/typdef.go b/internal/lsp/testdata/typdef/typdef.go deleted file mode 100644 index bd2ea4b00..000000000 --- a/internal/lsp/testdata/typdef/typdef.go +++ /dev/null @@ -1,65 +0,0 @@ -package typdef - -type Struct struct { //@item(Struct, "Struct", "struct{...}", "struct") - Field string -} - -type Int int //@item(Int, "Int", "int", "type") - -func _() { - var ( - value Struct - point *Struct - ) - _ = value //@typdef("value", Struct) - _ = point //@typdef("point", Struct) - - var ( - array [3]Struct - slice []Struct - ch chan Struct - complex [3]chan *[5][]Int - ) - _ = array //@typdef("array", Struct) - _ = slice //@typdef("slice", Struct) - _ = ch //@typdef("ch", Struct) - _ = complex //@typdef("complex", Int) - - var s struct { - x struct { - xx struct { - field1 []Struct - field2 []Int - } - } - } - s.x.xx.field1 //@typdef("field1", Struct) - s.x.xx.field2 //@typdef("field2", Int) -} - -func F1() Int { return 0 } -func F2() (Int, float64) { return 0, 0 } -func F3() (Struct, int, bool, error) { return Struct{}, 0, false, nil } -func F4() (**int, Int, bool, *error) { return nil, Struct{}, false, nil } -func F5() (int, float64, error, Struct) { return 0, 0, nil, Struct{} } -func F6() (int, float64, ***Struct, error) { return 0, 0, nil, nil } - -func _() { - F1() //@typdef("F1", Int) - F2() //@typdef("F2", Int) - F3() //@typdef("F3", Struct) - F4() //@typdef("F4", Int) - F5() //@typdef("F5", Struct) - F6() //@typdef("F6", Struct) - - f := func() Int { return 0 } - f() //@typdef("f", Int) -} - -// https://github.com/golang/go/issues/38589#issuecomment-620350922 -func _() { - type myFunc func(int) Int //@item(myFunc, "myFunc", "func", "type") - - var foo myFunc - bar := foo() //@typdef("foo", myFunc) -} diff --git a/internal/lsp/testdata/typeassert/type_assert.go b/internal/lsp/testdata/typeassert/type_assert.go deleted file mode 100644 index e24b68a07..000000000 --- a/internal/lsp/testdata/typeassert/type_assert.go +++ /dev/null @@ -1,24 +0,0 @@ -package typeassert - -type abc interface { //@item(abcIntf, "abc", "interface{...}", "interface") - abc() -} - -type abcImpl struct{} //@item(abcImpl, "abcImpl", "struct{...}", "struct") -func (abcImpl) abc() - -type abcPtrImpl struct{} //@item(abcPtrImpl, "abcPtrImpl", "struct{...}", "struct") -func (*abcPtrImpl) abc() - -type abcNotImpl struct{} //@item(abcNotImpl, "abcNotImpl", "struct{...}", "struct") - -func _() { - var a abc - switch a.(type) { - case ab: //@complete(":", abcImpl, abcPtrImpl, abcIntf, abcNotImpl) - case *ab: //@complete(":", abcImpl, abcPtrImpl, abcIntf, abcNotImpl) - } - - a.(ab) //@complete(")", abcImpl, abcPtrImpl, abcIntf, abcNotImpl) - a.(*ab) //@complete(")", abcImpl, abcPtrImpl, abcIntf, abcNotImpl) -} diff --git a/internal/lsp/testdata/typeerrors/noresultvalues.go b/internal/lsp/testdata/typeerrors/noresultvalues.go deleted file mode 100644 index 84234c4b9..000000000 --- a/internal/lsp/testdata/typeerrors/noresultvalues.go +++ /dev/null @@ -1,5 +0,0 @@ -package typeerrors - -func x() { return nil } //@suggestedfix("nil", "quickfix") - -func y() { return nil, "hello" } //@suggestedfix("nil", "quickfix") diff --git a/internal/lsp/testdata/typeerrors/noresultvalues.go.golden b/internal/lsp/testdata/typeerrors/noresultvalues.go.golden deleted file mode 100644 index 07c54d445..000000000 --- a/internal/lsp/testdata/typeerrors/noresultvalues.go.golden +++ /dev/null @@ -1,14 +0,0 @@ --- suggestedfix_noresultvalues_3_19 -- -package typeerrors - -func x() { return } //@suggestedfix("nil", "quickfix") - -func y() { return nil, "hello" } //@suggestedfix("nil", "quickfix") - --- suggestedfix_noresultvalues_5_19 -- -package typeerrors - -func x() { return nil } //@suggestedfix("nil", "quickfix") - -func y() { return } //@suggestedfix("nil", "quickfix") - diff --git a/internal/lsp/testdata/typemods/type_mods.go b/internal/lsp/testdata/typemods/type_mods.go deleted file mode 100644 index f5f0f8076..000000000 --- a/internal/lsp/testdata/typemods/type_mods.go +++ /dev/null @@ -1,21 +0,0 @@ -package typemods - -func fooFunc() func() int { //@item(modFooFunc, "fooFunc", "func() func() int", "func") - return func() int { - return 0 - } -} - -func fooPtr() *int { //@item(modFooPtr, "fooPtr", "func() *int", "func") - return nil -} - -func _() { - var _ int = foo //@snippet(" //", modFooFunc, "fooFunc()()", "fooFunc()()"),snippet(" //", modFooPtr, "*fooPtr()", "*fooPtr()") -} - -func _() { - var m map[int][]chan int //@item(modMapChanPtr, "m", "map[int]chan *int", "var") - - var _ int = m //@snippet(" //", modMapChanPtr, "<-m[${1:}][${2:}]", "<-m[${1:}][${2:}]") -} diff --git a/internal/lsp/testdata/typeparams/type_params.go b/internal/lsp/testdata/typeparams/type_params.go deleted file mode 100644 index 1dfb1034a..000000000 --- a/internal/lsp/testdata/typeparams/type_params.go +++ /dev/null @@ -1,33 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -package typeparams - -func one[a int | string]() {} -func two[a int | string, b float64 | int]() {} - -func _() { - one[]() //@rank("]", string, float64) - two[]() //@rank("]", int, float64) - two[int, f]() //@rank("]", float64, float32) -} - -func slices[a []int | []float64]() {} //@item(tpInts, "[]int", "[]int", "type"),item(tpFloats, "[]float64", "[]float64", "type") - -func _() { - slices[]() //@rank("]", tpInts),rank("]", tpFloats) -} - -type s[a int | string] struct{} - -func _() { - s[]{} //@rank("]", int, float64) -} - -func returnTP[A int | float64](a A) A { //@item(returnTP, "returnTP", "something", "func") - return a -} - -func _() { - var _ int = returnTP //@snippet(" //", returnTP, "returnTP[${1:}](${2:})", "returnTP[${1:A int|float64}](${2:a A})") -} diff --git a/internal/lsp/testdata/types/types.go b/internal/lsp/testdata/types/types.go deleted file mode 100644 index c60d4b2e4..000000000 --- a/internal/lsp/testdata/types/types.go +++ /dev/null @@ -1,18 +0,0 @@ -package types - -type CoolAlias = int //@item(CoolAlias, "CoolAlias", "int", "type") - -type X struct { //@item(X_struct, "X", "struct{...}", "struct") - x int -} - -type Y struct { //@item(Y_struct, "Y", "struct{...}", "struct") - y int -} - -type Bob interface { //@item(Bob_interface, "Bob", "interface{...}", "interface") - Bobby() -} - -func (*X) Bobby() {} -func (*Y) Bobby() {} diff --git a/internal/lsp/testdata/undeclared/var.go b/internal/lsp/testdata/undeclared/var.go deleted file mode 100644 index b5f9287d4..000000000 --- a/internal/lsp/testdata/undeclared/var.go +++ /dev/null @@ -1,14 +0,0 @@ -package undeclared - -func m() int { - z, _ := 1+y, 11 //@diag("y", "compiler", "undeclared name: y", "error"),suggestedfix("y", "quickfix") - if 100 < 90 { - z = 1 - } else if 100 > n+2 { //@diag("n", "compiler", "undeclared name: n", "error"),suggestedfix("n", "quickfix") - z = 4 - } - for i < 200 { //@diag("i", "compiler", "undeclared name: i", "error"),suggestedfix("i", "quickfix") - } - r() //@diag("r", "compiler", "undeclared name: r", "error") - return z -} diff --git a/internal/lsp/testdata/undeclared/var.go.golden b/internal/lsp/testdata/undeclared/var.go.golden deleted file mode 100644 index 74adbe8ff..000000000 --- a/internal/lsp/testdata/undeclared/var.go.golden +++ /dev/null @@ -1,51 +0,0 @@ --- suggestedfix_var_10_6 -- -package undeclared - -func m() int { - z, _ := 1+y, 11 //@diag("y", "compiler", "undeclared name: y", "error"),suggestedfix("y", "quickfix") - if 100 < 90 { - z = 1 - } else if 100 > n+2 { //@diag("n", "compiler", "undeclared name: n", "error"),suggestedfix("n", "quickfix") - z = 4 - } - i := - for i < 200 { //@diag("i", "compiler", "undeclared name: i", "error"),suggestedfix("i", "quickfix") - } - r() //@diag("r", "compiler", "undeclared name: r", "error") - return z -} - --- suggestedfix_var_4_12 -- -package undeclared - -func m() int { - y := - z, _ := 1+y, 11 //@diag("y", "compiler", "undeclared name: y", "error"),suggestedfix("y", "quickfix") - if 100 < 90 { - z = 1 - } else if 100 > n+2 { //@diag("n", "compiler", "undeclared name: n", "error"),suggestedfix("n", "quickfix") - z = 4 - } - for i < 200 { //@diag("i", "compiler", "undeclared name: i", "error"),suggestedfix("i", "quickfix") - } - r() //@diag("r", "compiler", "undeclared name: r", "error") - return z -} - --- suggestedfix_var_7_18 -- -package undeclared - -func m() int { - z, _ := 1+y, 11 //@diag("y", "compiler", "undeclared name: y", "error"),suggestedfix("y", "quickfix") - n := - if 100 < 90 { - z = 1 - } else if 100 > n+2 { //@diag("n", "compiler", "undeclared name: n", "error"),suggestedfix("n", "quickfix") - z = 4 - } - for i < 200 { //@diag("i", "compiler", "undeclared name: i", "error"),suggestedfix("i", "quickfix") - } - r() //@diag("r", "compiler", "undeclared name: r", "error") - return z -} - diff --git a/internal/lsp/testdata/unimported/export_test.go b/internal/lsp/testdata/unimported/export_test.go deleted file mode 100644 index 4f85700fa..000000000 --- a/internal/lsp/testdata/unimported/export_test.go +++ /dev/null @@ -1,3 +0,0 @@ -package unimported - -var TestExport int //@item(testexport, "TestExport", "(from \"golang.org/x/tools/internal/lsp/unimported\")", "var") diff --git a/internal/lsp/testdata/unimported/unimported.go.in b/internal/lsp/testdata/unimported/unimported.go.in deleted file mode 100644 index c3c0243d9..000000000 --- a/internal/lsp/testdata/unimported/unimported.go.in +++ /dev/null @@ -1,20 +0,0 @@ -package unimported - -func _() { - http //@unimported("p", nethttp) - // container/ring is extremely unlikely to be imported by anything, so shouldn't have type information. - ring.Ring //@unimported("Ring", ringring) - signature.Foo //@unimported("Foo", signaturefoo) - - context.Bac //@unimported(" //", contextBackground, contextBackgroundErr) -} - -// Create markers for unimported std lib packages. Only for use by this test. -/* http */ //@item(nethttp, "http", "\"net/http\"", "package") - -/* ring.Ring */ //@item(ringring, "Ring", "(from \"container/ring\")", "var") - -/* signature.Foo */ //@item(signaturefoo, "Foo", "func(a string, b int) (c bool) (from \"golang.org/x/tools/internal/lsp/signature\")", "func") - -/* context.Background */ //@item(contextBackground, "Background", "func() context.Context (from \"context\")", "func") -/* context.Background().Err */ //@item(contextBackgroundErr, "Background().Err", "func() error (from \"context\")", "method") diff --git a/internal/lsp/testdata/unimported/unimported_cand_type.go b/internal/lsp/testdata/unimported/unimported_cand_type.go deleted file mode 100644 index 531aa2d18..000000000 --- a/internal/lsp/testdata/unimported/unimported_cand_type.go +++ /dev/null @@ -1,16 +0,0 @@ -package unimported - -import ( - _ "context" - - "golang.org/x/tools/internal/lsp/baz" - _ "golang.org/x/tools/internal/lsp/signature" // provide type information for unimported completions in the other file -) - -func _() { - foo.StructFoo{} //@item(litFooStructFoo, "foo.StructFoo{}", "struct{...}", "struct") - - // We get the literal completion for "foo.StructFoo{}" even though we haven't - // imported "foo" yet. - baz.FooStruct = f //@snippet(" //", litFooStructFoo, "foo.StructFoo{$0\\}", "foo.StructFoo{$0\\}") -} diff --git a/internal/lsp/testdata/unimported/x_test.go b/internal/lsp/testdata/unimported/x_test.go deleted file mode 100644 index 681dcb253..000000000 --- a/internal/lsp/testdata/unimported/x_test.go +++ /dev/null @@ -1,9 +0,0 @@ -package unimported_test - -import ( - "testing" -) - -func TestSomething(t *testing.T) { - _ = unimported.TestExport //@unimported("TestExport", testexport) -} diff --git a/internal/lsp/testdata/unresolved/unresolved.go.in b/internal/lsp/testdata/unresolved/unresolved.go.in deleted file mode 100644 index e1daecc2e..000000000 --- a/internal/lsp/testdata/unresolved/unresolved.go.in +++ /dev/null @@ -1,6 +0,0 @@ -package unresolved - -func foo(interface{}) { - // don't crash on fake "resolved" type - foo(func(i, j f //@complete(" //") -} diff --git a/internal/lsp/testdata/unsafe/unsafe.go b/internal/lsp/testdata/unsafe/unsafe.go deleted file mode 100644 index 5d5e43407..000000000 --- a/internal/lsp/testdata/unsafe/unsafe.go +++ /dev/null @@ -1,13 +0,0 @@ -package unsafe
-
-import (
- "unsafe"
-)
-
-// Pre-set this marker, as we don't have a "source" for it in this package.
-/* unsafe.Sizeof */ //@item(Sizeof, "Sizeof", "invalid type", "text")
-
-func _() {
- x := struct{}{}
- _ = unsafe.Sizeof(x) //@complete("z", Sizeof)
-}
diff --git a/internal/lsp/testdata/variadic/variadic.go.in b/internal/lsp/testdata/variadic/variadic.go.in deleted file mode 100644 index 4787498ce..000000000 --- a/internal/lsp/testdata/variadic/variadic.go.in +++ /dev/null @@ -1,38 +0,0 @@ -package variadic - -func foo(i int, strs ...string) {} - -func bar() []string { //@item(vFunc, "bar", "func() []string", "func") - return nil -} - -func _() { - var ( - i int //@item(vInt, "i", "int", "var") - s string //@item(vStr, "s", "string", "var") - ss []string //@item(vStrSlice, "ss", "[]string", "var") - v interface{} //@item(vIntf, "v", "interface{}", "var") - ) - - foo() //@rank(")", vInt, vStr),rank(")", vInt, vStrSlice) - foo(123, ) //@rank(")", vStr, vInt),rank(")", vStrSlice, vInt) - foo(123, "", ) //@rank(")", vStr, vInt),rank(")", vStr, vStrSlice) - foo(123, s, "") //@rank(", \"", vStr, vStrSlice) - - // snippet will add the "..." for you - foo(123, ) //@snippet(")", vStrSlice, "ss...", "ss..."),snippet(")", vFunc, "bar()...", "bar()..."),snippet(")", vStr, "s", "s") - - // don't add "..." for interface{} - foo(123, ) //@snippet(")", vIntf, "v", "v") -} - -func qux(...func()) {} -func f() {} //@item(vVarArg, "f", "func()", "func") - -func _() { - qux(f) //@snippet(")", vVarArg, "f", "f") -} - -func _() { - foo(0, []string{}...) //@complete(")") -} diff --git a/internal/lsp/testdata/variadic/variadic_intf.go b/internal/lsp/testdata/variadic/variadic_intf.go deleted file mode 100644 index 6e23fc996..000000000 --- a/internal/lsp/testdata/variadic/variadic_intf.go +++ /dev/null @@ -1,21 +0,0 @@ -package variadic - -type baz interface { - baz() -} - -func wantsBaz(...baz) {} - -type bazImpl int - -func (bazImpl) baz() {} - -func _() { - var ( - impls []bazImpl //@item(vImplSlice, "impls", "[]bazImpl", "var") - impl bazImpl //@item(vImpl, "impl", "bazImpl", "var") - bazes []baz //@item(vIntfSlice, "bazes", "[]baz", "var") - ) - - wantsBaz() //@rank(")", vImpl, vImplSlice),rank(")", vIntfSlice, vImplSlice) -} diff --git a/internal/lsp/testdata/workspacesymbol/a/a.go b/internal/lsp/testdata/workspacesymbol/a/a.go deleted file mode 100644 index 6e5a68b16..000000000 --- a/internal/lsp/testdata/workspacesymbol/a/a.go +++ /dev/null @@ -1,9 +0,0 @@ -package a - -var RandomGopherVariableA = "a" //@symbol("RandomGopherVariableA", "RandomGopherVariableA", "Variable", "", "a.RandomGopherVariableA") - -const RandomGopherConstantA = "a" //@symbol("RandomGopherConstantA", "RandomGopherConstantA", "Constant", "", "a.RandomGopherConstantA") - -const ( - randomgopherinvariable = iota //@symbol("randomgopherinvariable", "randomgopherinvariable", "Constant", "", "a.randomgopherinvariable") -) diff --git a/internal/lsp/testdata/workspacesymbol/a/a.go.golden b/internal/lsp/testdata/workspacesymbol/a/a.go.golden deleted file mode 100644 index c3f088577..000000000 --- a/internal/lsp/testdata/workspacesymbol/a/a.go.golden +++ /dev/null @@ -1,5 +0,0 @@ --- symbols -- -RandomGopherVariableA Variable 3:5-3:26 -RandomGopherConstantA Constant 5:7-5:28 -randomgopherinvariable Constant 8:2-8:24 - diff --git a/internal/lsp/testdata/workspacesymbol/a/a_test.go b/internal/lsp/testdata/workspacesymbol/a/a_test.go deleted file mode 100644 index 30d534097..000000000 --- a/internal/lsp/testdata/workspacesymbol/a/a_test.go +++ /dev/null @@ -1,3 +0,0 @@ -package a - -var RandomGopherTestVariableA = "a" //@symbol("RandomGopherTestVariableA", "RandomGopherTestVariableA", "Variable", "", "a.RandomGopherTestVariableA") diff --git a/internal/lsp/testdata/workspacesymbol/a/a_test.go.golden b/internal/lsp/testdata/workspacesymbol/a/a_test.go.golden deleted file mode 100644 index af7461943..000000000 --- a/internal/lsp/testdata/workspacesymbol/a/a_test.go.golden +++ /dev/null @@ -1,3 +0,0 @@ --- symbols -- -RandomGopherTestVariableA Variable 3:5-3:30 - diff --git a/internal/lsp/testdata/workspacesymbol/a/a_x_test.go b/internal/lsp/testdata/workspacesymbol/a/a_x_test.go deleted file mode 100644 index 76eb8487d..000000000 --- a/internal/lsp/testdata/workspacesymbol/a/a_x_test.go +++ /dev/null @@ -1,3 +0,0 @@ -package a_test - -var RandomGopherXTestVariableA = "a" //@symbol("RandomGopherXTestVariableA", "RandomGopherXTestVariableA", "Variable", "", "a_test.RandomGopherXTestVariableA") diff --git a/internal/lsp/testdata/workspacesymbol/a/a_x_test.go.golden b/internal/lsp/testdata/workspacesymbol/a/a_x_test.go.golden deleted file mode 100644 index dfd02a5c4..000000000 --- a/internal/lsp/testdata/workspacesymbol/a/a_x_test.go.golden +++ /dev/null @@ -1,3 +0,0 @@ --- symbols -- -RandomGopherXTestVariableA Variable 3:5-3:31 - diff --git a/internal/lsp/testdata/workspacesymbol/b/b.go b/internal/lsp/testdata/workspacesymbol/b/b.go deleted file mode 100644 index 89ce0d92e..000000000 --- a/internal/lsp/testdata/workspacesymbol/b/b.go +++ /dev/null @@ -1,7 +0,0 @@ -package b - -var RandomGopherVariableB = "b" //@symbol("RandomGopherVariableB", "RandomGopherVariableB", "Variable", "", "b.RandomGopherVariableB") - -type RandomGopherStructB struct { //@symbol("RandomGopherStructB", "RandomGopherStructB", "Struct", "", "b.RandomGopherStructB") - Bar int //@mark(bBar, "Bar"), symbol("Bar", "Bar", "Field", "RandomGopherStructB", "b.RandomGopherStructB.Bar") -} diff --git a/internal/lsp/testdata/workspacesymbol/b/b.go.golden b/internal/lsp/testdata/workspacesymbol/b/b.go.golden deleted file mode 100644 index 4711c9d91..000000000 --- a/internal/lsp/testdata/workspacesymbol/b/b.go.golden +++ /dev/null @@ -1,5 +0,0 @@ --- symbols -- -RandomGopherVariableB Variable 3:5-3:26 -RandomGopherStructB Struct 5:6-5:25 - Bar Field 6:2-6:5 - diff --git a/internal/lsp/testdata/workspacesymbol/issue44806.go b/internal/lsp/testdata/workspacesymbol/issue44806.go deleted file mode 100644 index 6a6e03a5f..000000000 --- a/internal/lsp/testdata/workspacesymbol/issue44806.go +++ /dev/null @@ -1,10 +0,0 @@ -package main - -type T struct{} - -// We should accept all valid receiver syntax when scanning symbols. -func (*(T)) m1() {} -func (*T) m2() {} -func (T) m3() {} -func ((T)) m4() {} -func ((*T)) m5() {} diff --git a/internal/lsp/testdata/workspacesymbol/main.go b/internal/lsp/testdata/workspacesymbol/main.go deleted file mode 100644 index 36ec8f1a5..000000000 --- a/internal/lsp/testdata/workspacesymbol/main.go +++ /dev/null @@ -1,47 +0,0 @@ -package main - -import ( - "encoding/json" - "fmt" -) - -func main() { // function - fmt.Println("Hello") -} - -var myvar int // variable - -type myType string // basic type - -type myDecoder json.Decoder // to use the encoding/json import - -func (m *myType) Blahblah() {} // method - -type myStruct struct { // struct type - myStructField int // struct field -} - -type myInterface interface { // interface - DoSomeCoolStuff() string // interface method -} - -type embed struct { - myStruct - - nestedStruct struct { - nestedField int - - nestedStruct2 struct { - int - } - } - - nestedInterface interface { - myInterface - nestedMethod() - } -} - -func Dunk() int { return 0 } - -func dunk() {} diff --git a/internal/lsp/testdata/workspacesymbol/p/p.go b/internal/lsp/testdata/workspacesymbol/p/p.go deleted file mode 100644 index 409cc3547..000000000 --- a/internal/lsp/testdata/workspacesymbol/p/p.go +++ /dev/null @@ -1,3 +0,0 @@ -package p - -const Message = "Hello World." // constant diff --git a/internal/lsp/testdata/workspacesymbol/query.go b/internal/lsp/testdata/workspacesymbol/query.go deleted file mode 100644 index 883aae268..000000000 --- a/internal/lsp/testdata/workspacesymbol/query.go +++ /dev/null @@ -1,29 +0,0 @@ -package main - -// Contains all of the workspace symbol queries. - -// -- Fuzzy matching -- -//@workspacesymbolfuzzy("rgop") -//@workspacesymbolfuzzy("randoma") -//@workspacesymbolfuzzy("randomb") - -// -- Case sensitive -- -//@workspacesymbolcasesensitive("main.main") -//@workspacesymbolcasesensitive("p.Message") -//@workspacesymbolcasesensitive("main.myvar") -//@workspacesymbolcasesensitive("main.myType") -//@workspacesymbolcasesensitive("main.myType.Blahblah") -//@workspacesymbolcasesensitive("main.myStruct") -//@workspacesymbolcasesensitive("main.myStruct.myStructField") -//@workspacesymbolcasesensitive("main.myInterface") -//@workspacesymbolcasesensitive("main.myInterface.DoSomeCoolStuff") -//@workspacesymbolcasesensitive("main.embed.myStruct") -//@workspacesymbolcasesensitive("main.embed.nestedStruct.nestedStruct2.int") -//@workspacesymbolcasesensitive("main.embed.nestedInterface.myInterface") -//@workspacesymbolcasesensitive("main.embed.nestedInterface.nestedMethod") -//@workspacesymbolcasesensitive("dunk") -//@workspacesymbolcasesensitive("Dunk") - -// -- Standard -- -//@workspacesymbol("") -//@workspacesymbol("randomgophervar") diff --git a/internal/lsp/testdata/workspacesymbol/query.go.golden b/internal/lsp/testdata/workspacesymbol/query.go.golden deleted file mode 100644 index 4c6d470f7..000000000 --- a/internal/lsp/testdata/workspacesymbol/query.go.golden +++ /dev/null @@ -1,83 +0,0 @@ --- workspace_symbol-caseinsensitive- -- - - --- workspace_symbol-caseinsensitive-randomgophervar -- -workspacesymbol/a/a.go:3:5-26 RandomGopherVariableA Variable -workspacesymbol/b/b.go:3:5-26 RandomGopherVariableB Variable - --- workspace_symbol-casesensitive-Dunk -- -workspacesymbol/main.go:45:6-10 Dunk Function - --- workspace_symbol-casesensitive-dunk -- -workspacesymbol/main.go:47:6-10 dunk Function - --- workspace_symbol-casesensitive-main.embed.myStruct -- -workspacesymbol/main.go:29:2-10 main.embed.myStruct Field - --- workspace_symbol-casesensitive-main.embed.nestedInterface.myInterface -- -workspacesymbol/main.go:40:3-14 main.embed.nestedInterface.myInterface Interface - --- workspace_symbol-casesensitive-main.embed.nestedInterface.nestedMethod -- -workspacesymbol/main.go:41:3-15 main.embed.nestedInterface.nestedMethod Method - --- workspace_symbol-casesensitive-main.embed.nestedStruct.nestedStruct2.int -- -workspacesymbol/main.go:35:4-7 main.embed.nestedStruct.nestedStruct2.int Field - --- workspace_symbol-casesensitive-main.main -- -workspacesymbol/main.go:8:6-10 main.main Function - --- workspace_symbol-casesensitive-main.myInterface -- -workspacesymbol/main.go:24:6-17 main.myInterface Interface -workspacesymbol/main.go:25:2-17 main.myInterface.DoSomeCoolStuff Method - --- workspace_symbol-casesensitive-main.myInterface.DoSomeCoolStuff -- -workspacesymbol/main.go:25:2-17 main.myInterface.DoSomeCoolStuff Method - --- workspace_symbol-casesensitive-main.myStruct -- -workspacesymbol/main.go:20:6-14 main.myStruct Struct -workspacesymbol/main.go:21:2-15 main.myStruct.myStructField Field - --- workspace_symbol-casesensitive-main.myStruct.myStructField -- -workspacesymbol/main.go:21:2-15 main.myStruct.myStructField Field - --- workspace_symbol-casesensitive-main.myType -- -workspacesymbol/main.go:14:6-12 main.myType Class -workspacesymbol/main.go:18:18-26 main.myType.Blahblah Method - --- workspace_symbol-casesensitive-main.myType.Blahblah -- -workspacesymbol/main.go:18:18-26 main.myType.Blahblah Method - --- workspace_symbol-casesensitive-main.myvar -- -workspacesymbol/main.go:12:5-10 main.myvar Variable - --- workspace_symbol-casesensitive-p.Message -- -workspacesymbol/p/p.go:3:7-14 p.Message Constant - --- workspace_symbol-fuzzy-randoma -- -workspacesymbol/a/a.go:3:5-26 RandomGopherVariableA Variable -workspacesymbol/a/a.go:5:7-28 RandomGopherConstantA Constant -workspacesymbol/a/a.go:8:2-24 randomgopherinvariable Constant -workspacesymbol/a/a_test.go:3:5-30 RandomGopherTestVariableA Variable -workspacesymbol/a/a_x_test.go:3:5-31 RandomGopherXTestVariableA Variable -workspacesymbol/b/b.go:3:5-26 RandomGopherVariableB Variable -workspacesymbol/b/b.go:6:2-5 RandomGopherStructB.Bar Field - --- workspace_symbol-fuzzy-randomb -- -workspacesymbol/a/a.go:3:5-26 RandomGopherVariableA Variable -workspacesymbol/a/a.go:8:2-24 randomgopherinvariable Constant -workspacesymbol/a/a_test.go:3:5-30 RandomGopherTestVariableA Variable -workspacesymbol/a/a_x_test.go:3:5-31 RandomGopherXTestVariableA Variable -workspacesymbol/b/b.go:3:5-26 RandomGopherVariableB Variable -workspacesymbol/b/b.go:5:6-25 RandomGopherStructB Struct -workspacesymbol/b/b.go:6:2-5 RandomGopherStructB.Bar Field - --- workspace_symbol-fuzzy-rgop -- -workspacesymbol/a/a.go:3:5-26 RandomGopherVariableA Variable -workspacesymbol/a/a.go:5:7-28 RandomGopherConstantA Constant -workspacesymbol/a/a.go:8:2-24 randomgopherinvariable Constant -workspacesymbol/a/a_test.go:3:5-30 RandomGopherTestVariableA Variable -workspacesymbol/a/a_x_test.go:3:5-31 RandomGopherXTestVariableA Variable -workspacesymbol/b/b.go:3:5-26 RandomGopherVariableB Variable -workspacesymbol/b/b.go:5:6-25 RandomGopherStructB Struct -workspacesymbol/b/b.go:6:2-5 RandomGopherStructB.Bar Field - |