Debian Codegraph @

gopls/internal/test/marker/testdata/symbol/basic.txt

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