@@ -79,6 +79,10 @@ func (s *server) Initialize(ctx context.Context, params *protocol.InitializePara
79
79
}
80
80
s .initialized = true // mark server as initialized now
81
81
82
+ if params .Trace != "verbose" {
83
+ params .Trace = "verbose"
84
+ }
85
+
82
86
// Check if the client supports snippets in completion items.
83
87
s .snippetsSupported = params .Capabilities .TextDocument .Completion .CompletionItem .SnippetSupport
84
88
s .signatureHelpEnabled = true
@@ -108,7 +112,7 @@ func (s *server) Initialize(ctx context.Context, params *protocol.InitializePara
108
112
Tests : true ,
109
113
})
110
114
111
- return & protocol.InitializeResult {
115
+ initializeResult := & protocol.InitializeResult {
112
116
Capabilities : protocol.ServerCapabilities {
113
117
CodeActionProvider : true ,
114
118
CompletionProvider : protocol.CompletionOptions {
@@ -127,7 +131,9 @@ func (s *server) Initialize(ctx context.Context, params *protocol.InitializePara
127
131
},
128
132
TypeDefinitionProvider : true ,
129
133
},
130
- }, nil
134
+ }
135
+
136
+ return initializeResult , nil
131
137
}
132
138
133
139
func (s * server ) Initialized (context.Context , * protocol.InitializedParams ) error {
@@ -220,7 +226,10 @@ func (s *server) Completion(ctx context.Context, params *protocol.CompletionPara
220
226
if err != nil {
221
227
return nil , err
222
228
}
223
- tok := f .GetToken ()
229
+ tok , err := f .GetToken ()
230
+ if err != nil {
231
+ return nil , err
232
+ }
224
233
pos := fromProtocolPosition (tok , params .Position )
225
234
items , prefix , err := source .Completion (ctx , f , pos )
226
235
if err != nil {
@@ -245,7 +254,10 @@ func (s *server) Hover(ctx context.Context, params *protocol.TextDocumentPositio
245
254
if err != nil {
246
255
return nil , err
247
256
}
248
- tok := f .GetToken ()
257
+ tok , err := f .GetToken ()
258
+ if err != nil {
259
+ return nil , err
260
+ }
249
261
pos := fromProtocolPosition (tok , params .Position )
250
262
ident , err := source .Identifier (ctx , s .view , f , pos )
251
263
if err != nil {
@@ -256,13 +268,14 @@ func (s *server) Hover(ctx context.Context, params *protocol.TextDocumentPositio
256
268
return nil , err
257
269
}
258
270
markdown := "```go\n " + content + "\n ```"
259
- return & protocol.Hover {
271
+ hover := & protocol.Hover {
260
272
Contents : protocol.MarkupContent {
261
273
Kind : protocol .Markdown ,
262
274
Value : markdown ,
263
275
},
264
276
Range : toProtocolRange (tok , ident .Range ),
265
- }, nil
277
+ }
278
+ return hover , nil
266
279
}
267
280
268
281
func (s * server ) SignatureHelp (ctx context.Context , params * protocol.TextDocumentPositionParams ) (* protocol.SignatureHelp , error ) {
@@ -274,7 +287,10 @@ func (s *server) SignatureHelp(ctx context.Context, params *protocol.TextDocumen
274
287
if err != nil {
275
288
return nil , err
276
289
}
277
- tok := f .GetToken ()
290
+ tok , err := f .GetToken ()
291
+ if err != nil {
292
+ return nil , err
293
+ }
278
294
pos := fromProtocolPosition (tok , params .Position )
279
295
info , err := source .SignatureHelp (ctx , f , pos )
280
296
if err != nil {
@@ -292,7 +308,10 @@ func (s *server) Definition(ctx context.Context, params *protocol.TextDocumentPo
292
308
if err != nil {
293
309
return nil , err
294
310
}
295
- tok := f .GetToken ()
311
+ tok , err := f .GetToken ()
312
+ if err != nil {
313
+ return nil , err
314
+ }
296
315
pos := fromProtocolPosition (tok , params .Position )
297
316
ident , err := source .Identifier (ctx , s .view , f , pos )
298
317
if err != nil {
@@ -310,7 +329,10 @@ func (s *server) TypeDefinition(ctx context.Context, params *protocol.TextDocume
310
329
if err != nil {
311
330
return nil , err
312
331
}
313
- tok := f .GetToken ()
332
+ tok , err := f .GetToken ()
333
+ if err != nil {
334
+ return nil , err
335
+ }
314
336
pos := fromProtocolPosition (tok , params .Position )
315
337
ident , err := source .Identifier (ctx , s .view , f , pos )
316
338
if err != nil {
0 commit comments