@@ -22,7 +22,7 @@ func DocumentSymbols(ctx context.Context, snapshot Snapshot, fh FileHandle) ([]p
22
22
if err != nil {
23
23
return nil , fmt .Errorf ("getting file for DocumentSymbols: %v" , err )
24
24
}
25
- file , m , _ , err := pgh .Cached ()
25
+ file , _ , _ , err := pgh .Cached ()
26
26
if err != nil {
27
27
return nil , err
28
28
}
@@ -37,7 +37,7 @@ func DocumentSymbols(ctx context.Context, snapshot Snapshot, fh FileHandle) ([]p
37
37
switch decl := decl .(type ) {
38
38
case * ast.FuncDecl :
39
39
if obj := info .ObjectOf (decl .Name ); obj != nil {
40
- fs , err := funcSymbol (ctx , snapshot .View (), m , decl , obj , q )
40
+ fs , err := funcSymbol (ctx , snapshot .View (), pkg , decl , obj , q )
41
41
if err != nil {
42
42
return nil , err
43
43
}
@@ -55,7 +55,7 @@ func DocumentSymbols(ctx context.Context, snapshot Snapshot, fh FileHandle) ([]p
55
55
switch spec := spec .(type ) {
56
56
case * ast.TypeSpec :
57
57
if obj := info .ObjectOf (spec .Name ); obj != nil {
58
- ts , err := typeSymbol (ctx , snapshot .View (), m , info , spec , obj , q )
58
+ ts , err := typeSymbol (ctx , snapshot .View (), pkg , info , spec , obj , q )
59
59
if err != nil {
60
60
return nil , err
61
61
}
@@ -65,7 +65,7 @@ func DocumentSymbols(ctx context.Context, snapshot Snapshot, fh FileHandle) ([]p
65
65
case * ast.ValueSpec :
66
66
for _ , name := range spec .Names {
67
67
if obj := info .ObjectOf (name ); obj != nil {
68
- vs , err := varSymbol (ctx , snapshot .View (), m , decl , name , obj , q )
68
+ vs , err := varSymbol (ctx , snapshot .View (), pkg , decl , name , obj , q )
69
69
if err != nil {
70
70
return nil , err
71
71
}
@@ -93,17 +93,17 @@ func DocumentSymbols(ctx context.Context, snapshot Snapshot, fh FileHandle) ([]p
93
93
return symbols , nil
94
94
}
95
95
96
- func funcSymbol (ctx context.Context , view View , m * protocol. ColumnMapper , decl * ast.FuncDecl , obj types.Object , q types.Qualifier ) (protocol.DocumentSymbol , error ) {
96
+ func funcSymbol (ctx context.Context , view View , pkg Package , decl * ast.FuncDecl , obj types.Object , q types.Qualifier ) (protocol.DocumentSymbol , error ) {
97
97
s := protocol.DocumentSymbol {
98
98
Name : obj .Name (),
99
99
Kind : protocol .Function ,
100
100
}
101
101
var err error
102
- s .Range , err = nodeToProtocolRange (view , m , decl )
102
+ s .Range , err = nodeToProtocolRange (view , pkg , decl )
103
103
if err != nil {
104
104
return protocol.DocumentSymbol {}, err
105
105
}
106
- s .SelectionRange , err = nodeToProtocolRange (view , m , decl .Name )
106
+ s .SelectionRange , err = nodeToProtocolRange (view , pkg , decl .Name )
107
107
if err != nil {
108
108
return protocol.DocumentSymbol {}, err
109
109
}
@@ -157,19 +157,19 @@ func setKind(s *protocol.DocumentSymbol, typ types.Type, q types.Qualifier) {
157
157
}
158
158
}
159
159
160
- func typeSymbol (ctx context.Context , view View , m * protocol. ColumnMapper , info * types.Info , spec * ast.TypeSpec , obj types.Object , q types.Qualifier ) (protocol.DocumentSymbol , error ) {
160
+ func typeSymbol (ctx context.Context , view View , pkg Package , info * types.Info , spec * ast.TypeSpec , obj types.Object , q types.Qualifier ) (protocol.DocumentSymbol , error ) {
161
161
s := protocol.DocumentSymbol {
162
162
Name : obj .Name (),
163
163
}
164
164
s .Detail , _ = formatType (obj .Type (), q )
165
165
setKind (& s , obj .Type (), q )
166
166
167
167
var err error
168
- s .Range , err = nodeToProtocolRange (view , m , spec )
168
+ s .Range , err = nodeToProtocolRange (view , pkg , spec )
169
169
if err != nil {
170
170
return protocol.DocumentSymbol {}, err
171
171
}
172
- s .SelectionRange , err = nodeToProtocolRange (view , m , spec .Name )
172
+ s .SelectionRange , err = nodeToProtocolRange (view , pkg , spec .Name )
173
173
if err != nil {
174
174
return protocol.DocumentSymbol {}, err
175
175
}
@@ -185,10 +185,10 @@ func typeSymbol(ctx context.Context, view View, m *protocol.ColumnMapper, info *
185
185
child .Detail , _ = formatType (f .Type (), q )
186
186
187
187
spanNode , selectionNode := nodesForStructField (i , st )
188
- if span , err := nodeToProtocolRange (view , m , spanNode ); err == nil {
188
+ if span , err := nodeToProtocolRange (view , pkg , spanNode ); err == nil {
189
189
child .Range = span
190
190
}
191
- if span , err := nodeToProtocolRange (view , m , selectionNode ); err == nil {
191
+ if span , err := nodeToProtocolRange (view , pkg , selectionNode ); err == nil {
192
192
child .SelectionRange = span
193
193
}
194
194
s .Children = append (s .Children , child )
@@ -215,11 +215,11 @@ func typeSymbol(ctx context.Context, view View, m *protocol.ColumnMapper, info *
215
215
}
216
216
}
217
217
}
218
- child .Range , err = nodeToProtocolRange (view , m , spanNode )
218
+ child .Range , err = nodeToProtocolRange (view , pkg , spanNode )
219
219
if err != nil {
220
220
return protocol.DocumentSymbol {}, err
221
221
}
222
- child .SelectionRange , err = nodeToProtocolRange (view , m , selectionNode )
222
+ child .SelectionRange , err = nodeToProtocolRange (view , pkg , selectionNode )
223
223
if err != nil {
224
224
return protocol.DocumentSymbol {}, err
225
225
}
@@ -249,11 +249,11 @@ func typeSymbol(ctx context.Context, view View, m *protocol.ColumnMapper, info *
249
249
break Embeddeds
250
250
}
251
251
}
252
- child .Range , err = nodeToProtocolRange (view , m , spanNode )
252
+ child .Range , err = nodeToProtocolRange (view , pkg , spanNode )
253
253
if err != nil {
254
254
return protocol.DocumentSymbol {}, err
255
255
}
256
- child .SelectionRange , err = nodeToProtocolRange (view , m , selectionNode )
256
+ child .SelectionRange , err = nodeToProtocolRange (view , pkg , selectionNode )
257
257
if err != nil {
258
258
return protocol.DocumentSymbol {}, err
259
259
}
@@ -283,7 +283,7 @@ func nodesForStructField(i int, st *ast.StructType) (span, selection ast.Node) {
283
283
return nil , nil
284
284
}
285
285
286
- func varSymbol (ctx context.Context , view View , m * protocol. ColumnMapper , decl ast.Node , name * ast.Ident , obj types.Object , q types.Qualifier ) (protocol.DocumentSymbol , error ) {
286
+ func varSymbol (ctx context.Context , view View , pkg Package , decl ast.Node , name * ast.Ident , obj types.Object , q types.Qualifier ) (protocol.DocumentSymbol , error ) {
287
287
s := protocol.DocumentSymbol {
288
288
Name : obj .Name (),
289
289
Kind : protocol .Variable ,
@@ -292,11 +292,11 @@ func varSymbol(ctx context.Context, view View, m *protocol.ColumnMapper, decl as
292
292
s .Kind = protocol .Constant
293
293
}
294
294
var err error
295
- s .Range , err = nodeToProtocolRange (view , m , decl )
295
+ s .Range , err = nodeToProtocolRange (view , pkg , decl )
296
296
if err != nil {
297
297
return protocol.DocumentSymbol {}, err
298
298
}
299
- s .SelectionRange , err = nodeToProtocolRange (view , m , name )
299
+ s .SelectionRange , err = nodeToProtocolRange (view , pkg , name )
300
300
if err != nil {
301
301
return protocol.DocumentSymbol {}, err
302
302
}
0 commit comments