diff --git a/cmd/protoc-gen-go-grpc/grpc.go b/cmd/protoc-gen-go-grpc/grpc.go index ddda50dacd45..3deac5b299b2 100644 --- a/cmd/protoc-gen-go-grpc/grpc.go +++ b/cmd/protoc-gen-go-grpc/grpc.go @@ -197,6 +197,9 @@ func genService(gen *protogen.Plugin, file *protogen.File, g *protogen.Generated g.P("// ", clientName, " is the client API for ", service.GoName, " service.") g.P("//") g.P("// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.") + g.P() // for vscode dosn't display top of comment + // print comment without '\n', if comment has '\n', vscode dosn't display it + g.P(strings.TrimSpace(service.Comments.Leading.String())) if service.Desc.Options().(*descriptorpb.ServiceOptions).GetDeprecated() { g.P("//") @@ -251,6 +254,10 @@ func genService(gen *protogen.Plugin, file *protogen.File, g *protogen.Generated g.P("// ", serverType, " is the server API for ", service.GoName, " service.") g.P("// All implementations ", mustOrShould, " embed Unimplemented", serverType) g.P("// for forward compatibility") + g.P() // for vscode dosn't display top of comment + // print comment without '\n', if comment has '\n', vscode dosn't display it + g.P(strings.TrimSpace(service.Comments.Leading.String())) + if service.Desc.Options().(*descriptorpb.ServiceOptions).GetDeprecated() { g.P("//") g.P(deprecationComment)