@@ -79,6 +79,10 @@ func (s *server) Initialize(ctx context.Context, params *protocol.InitializePara
7979 }
8080 s .initialized = true // mark server as initialized now
8181
82+ if params .Trace != "verbose" {
83+ params .Trace = "verbose"
84+ }
85+
8286 // Check if the client supports snippets in completion items.
8387 s .snippetsSupported = params .Capabilities .TextDocument .Completion .CompletionItem .SnippetSupport
8488 s .signatureHelpEnabled = true
@@ -108,7 +112,7 @@ func (s *server) Initialize(ctx context.Context, params *protocol.InitializePara
108112 Tests : true ,
109113 })
110114
111- return & protocol.InitializeResult {
115+ initializeResult := & protocol.InitializeResult {
112116 Capabilities : protocol.ServerCapabilities {
113117 CodeActionProvider : true ,
114118 CompletionProvider : protocol.CompletionOptions {
@@ -127,7 +131,9 @@ func (s *server) Initialize(ctx context.Context, params *protocol.InitializePara
127131 },
128132 TypeDefinitionProvider : true ,
129133 },
130- }, nil
134+ }
135+
136+ return initializeResult , nil
131137}
132138
133139func (s * server ) Initialized (context.Context , * protocol.InitializedParams ) error {
@@ -220,7 +226,10 @@ func (s *server) Completion(ctx context.Context, params *protocol.CompletionPara
220226 if err != nil {
221227 return nil , err
222228 }
223- tok := f .GetToken ()
229+ tok , err := f .GetToken ()
230+ if err != nil {
231+ return nil , err
232+ }
224233 pos := fromProtocolPosition (tok , params .Position )
225234 items , prefix , err := source .Completion (ctx , f , pos )
226235 if err != nil {
@@ -245,7 +254,10 @@ func (s *server) Hover(ctx context.Context, params *protocol.TextDocumentPositio
245254 if err != nil {
246255 return nil , err
247256 }
248- tok := f .GetToken ()
257+ tok , err := f .GetToken ()
258+ if err != nil {
259+ return nil , err
260+ }
249261 pos := fromProtocolPosition (tok , params .Position )
250262 ident , err := source .Identifier (ctx , s .view , f , pos )
251263 if err != nil {
@@ -256,13 +268,14 @@ func (s *server) Hover(ctx context.Context, params *protocol.TextDocumentPositio
256268 return nil , err
257269 }
258270 markdown := "```go\n " + content + "\n ```"
259- return & protocol.Hover {
271+ hover := & protocol.Hover {
260272 Contents : protocol.MarkupContent {
261273 Kind : protocol .Markdown ,
262274 Value : markdown ,
263275 },
264276 Range : toProtocolRange (tok , ident .Range ),
265- }, nil
277+ }
278+ return hover , nil
266279}
267280
268281func (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
274287 if err != nil {
275288 return nil , err
276289 }
277- tok := f .GetToken ()
290+ tok , err := f .GetToken ()
291+ if err != nil {
292+ return nil , err
293+ }
278294 pos := fromProtocolPosition (tok , params .Position )
279295 info , err := source .SignatureHelp (ctx , f , pos )
280296 if err != nil {
@@ -292,7 +308,10 @@ func (s *server) Definition(ctx context.Context, params *protocol.TextDocumentPo
292308 if err != nil {
293309 return nil , err
294310 }
295- tok := f .GetToken ()
311+ tok , err := f .GetToken ()
312+ if err != nil {
313+ return nil , err
314+ }
296315 pos := fromProtocolPosition (tok , params .Position )
297316 ident , err := source .Identifier (ctx , s .view , f , pos )
298317 if err != nil {
@@ -310,7 +329,10 @@ func (s *server) TypeDefinition(ctx context.Context, params *protocol.TextDocume
310329 if err != nil {
311330 return nil , err
312331 }
313- tok := f .GetToken ()
332+ tok , err := f .GetToken ()
333+ if err != nil {
334+ return nil , err
335+ }
314336 pos := fromProtocolPosition (tok , params .Position )
315337 ident , err := source .Identifier (ctx , s .view , f , pos )
316338 if err != nil {
0 commit comments