gogo / letmegrpc

[maintainer wanted] generates a web form gui from a grpc specification
BSD 3-Clause "New" or "Revised" License
421 stars 48 forks source link

How to display help text? #30

Open tgulacsi opened 8 years ago

tgulacsi commented 8 years ago

As I've investigated, the comments before the field (in the .proto file) are read and provided to Builder. But I don't see this appear anywhere. There's a "setLink" in the js code, but nowhere called.

What do I miss?

awalterschulze commented 8 years ago

There should be a little question mark next to your field. When you hover over this your text should be displayed. Does this not work for you? If not please provide a sample file for which this does not work.

tgulacsi commented 8 years ago
cd /tmp
unzip letme-30.zip
"protoc" "--letmegrpc_out=plugins=grpc:/tmp/src" "--proto_path=/tmp/src:." "/tmp/src/unosoft.hu/ws/bruno/pb/portal/portal.proto"

letme-30.zip

and the generated /tmp/src/unosoft.hu/ws/bruno/pb/portal/portal.letmegrpc.go does not contain help, though /tmp/src/unosoft.hu/ws/bruno/pb/db_web/db_web.proto does contains comments.

awalterschulze commented 8 years ago

setLink is only used to non repeated messages. You should be looking for "tooltip"

awalterschulze commented 8 years ago

Or rather data-toggle="tooltip"

awalterschulze commented 8 years ago
help := g.Comments(fmt.Sprintf("%s,%d,%d", msg.Path(), 2, i))

Is used to get the comment, where i is the field index.

awalterschulze commented 8 years ago

The Comments method describes has this documentation

// Comments returns any comments from the source .proto file and empty string if comments not found.
// The path is a comma-separated list of intergers.
// See descriptor.proto for its format.
awalterschulze commented 8 years ago

I found this in the descriptor.proto

message SourceCodeInfo {
  // A Location identifies a piece of source code in a .proto file which
  // corresponds to a particular definition.  This information is intended
  // to be useful to IDEs, code indexers, documentation generators, and similar
  // tools.
  //
  // For example, say we have a file like:
  //   message Foo {
  //     optional string foo = 1;
  //   }
  // Let's look at just the field definition:
  //   optional string foo = 1;
  //   ^       ^^     ^^  ^  ^^^
  //   a       bc     de  f  ghi
  // We have the following locations:
  //   span   path               represents
  //   [a,i)  [ 4, 0, 2, 0 ]     The whole field definition.
  //   [a,b)  [ 4, 0, 2, 0, 4 ]  The label (optional).
  //   [c,d)  [ 4, 0, 2, 0, 5 ]  The type (string).
  //   [e,f)  [ 4, 0, 2, 0, 1 ]  The name (foo).
  //   [g,h)  [ 4, 0, 2, 0, 3 ]  The number (1).
awalterschulze commented 8 years ago

Maybe the SourceCodeInfo is being passed along and letmegrpc is unable to get the comments

awalterschulze commented 8 years ago

That doesn't seem to be the problem.

How do I run your code? I would like to see the Chrome debug information. Maybe its not escaping something correctly