golang.org/x/tools/gopls@v0.15.3/internal/test/marker/testdata/symbol/basic.txt (about) 1 Basic tests of textDocument/documentSymbols. 2 3 -- symbol.go -- 4 package main 5 6 //@symbol(want) 7 8 import "io" 9 10 var _ = 1 11 12 var x = 42 13 14 var nested struct { 15 nestedField struct { 16 f int 17 } 18 } 19 20 const y = 43 21 22 type Number int 23 24 type Alias = string 25 26 type NumberAlias = Number 27 28 type ( 29 Boolean bool 30 BoolAlias = bool 31 ) 32 33 type Foo struct { 34 Quux 35 W io.Writer 36 Bar int 37 baz string 38 funcField func(int) int 39 } 40 41 type Quux struct { 42 X, Y float64 43 } 44 45 type EmptyStruct struct{} 46 47 func (f Foo) Baz() string { 48 return f.baz 49 } 50 51 func _() {} 52 53 func (q *Quux) Do() {} 54 55 func main() { 56 } 57 58 type Stringer interface { 59 String() string 60 } 61 62 type ABer interface { 63 B() 64 A() string 65 } 66 67 type WithEmbeddeds interface { 68 Do() 69 ABer 70 io.Writer 71 } 72 73 type EmptyInterface interface{} 74 75 func Dunk() int { return 0 } 76 77 func dunk() {} 78 79 -- @want -- 80 (*Quux).Do "func()" 81 (Foo).Baz "func() string" +2 lines 82 ABer "interface{...}" +3 lines 83 ABer.A "func() string" 84 ABer.B "func()" 85 Alias "string" 86 BoolAlias "bool" 87 Boolean "bool" 88 Dunk "func() int" 89 EmptyInterface "interface{}" 90 EmptyStruct "struct{}" 91 Foo "struct{...}" +6 lines 92 Foo.Bar "int" 93 Foo.Quux "Quux" 94 Foo.W "io.Writer" 95 Foo.baz "string" 96 Foo.funcField "func(int) int" 97 Number "int" 98 NumberAlias "Number" 99 Quux "struct{...}" +2 lines 100 Quux.X "float64" 101 Quux.Y "float64" 102 Stringer "interface{...}" +2 lines 103 Stringer.String "func() string" 104 WithEmbeddeds "interface{...}" +4 lines 105 WithEmbeddeds.ABer "ABer" 106 WithEmbeddeds.Do "func()" 107 WithEmbeddeds.Writer "io.Writer" 108 dunk "func()" 109 main "func()" +1 lines 110 nested "struct{...}" +4 lines 111 nested.nestedField "struct{...}" +2 lines 112 nested.nestedField.f "int" 113 x "" 114 y ""