1
0
mirror of https://github.com/golang/go synced 2024-11-18 11:04:42 -07:00

internal/lsp: fill in ServerInfo in the initialize response

Fixes golang/go#38459

Change-Id: I98476ddc35c4ab2c43145083149454875cb4b041
Reviewed-on: https://go-review.googlesource.com/c/tools/+/228398
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
This commit is contained in:
Hana (Hyang-Ah) Kim 2020-04-15 15:59:30 -04:00 committed by Hyang-Ah Hana Kim
parent f038785680
commit fc959738d6

View File

@ -73,6 +73,10 @@ func (s *Server) initialize(ctx context.Context, params *protocol.ParamInitializ
PrepareProvider: r.PrepareSupport,
}
}
goplsVer := &bytes.Buffer{}
debug.PrintVersionInfo(ctx, goplsVer, true, debug.PlainText)
return &protocol.InitializeResult{
Capabilities: protocol.ServerCapabilities{
CodeActionProvider: codeActionProvider,
@ -111,6 +115,13 @@ func (s *Server) initialize(ctx context.Context, params *protocol.ParamInitializ
},
},
},
ServerInfo: struct {
Name string `json:"name"`
Version string `json:"version,omitempty"`
}{
Name: "gopls",
Version: goplsVer.String(),
},
}, nil
}
@ -159,6 +170,7 @@ func (s *Server) initialized(ctx context.Context, params *protocol.InitializedPa
})
}
// TODO: this event logging may be unnecessary. The version info is included in the initialize response.
buf := &bytes.Buffer{}
debug.PrintVersionInfo(ctx, buf, true, debug.PlainText)
event.Print(ctx, buf.String())