gogo / letmegrpc

[maintainer wanted] generates a web form gui from a grpc specification

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to display help text?

tgulacsi opened this issue · comments

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?

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.

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.

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

Or rather data-toggle="tooltip"

help := g.Comments(fmt.Sprintf("%s,%d,%d", msg.Path(), 2, i))

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

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.

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).

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

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