how to set protobuf filedName and coment as variables in live template?

I have a protobuf file as follow:

``` test.proto

syntax = "proto3";

package api.test.test;

option go_package = "exmple.com/api/test;test";

 

message Test {

string code = 1; // stock_code @gotags: gorm:"type:bigint NOT NULL DEFAULT 0 COMMENT 'stock_code';"

string company_name = 2 [json_name = "company_name"];

string filed_name = 3 ; // comment @gotags: gorm:"type:bigint NOT NULL DEFAULT 0 COMMENT 'comment';"

}

```

What I want to do is get `filed_name` and `comment` in line 10 in the test.proto file as live template variables as follow, what should I do?

  • 打开设置: File -> Settings -> Editor -> Live Templates -> proto 
  • add json template 

     

```template-text

[json_name =  "$FIELD_NAME$"]  $commnet$

```

  • click button “Edit Variables…"

    what's the Expression for variable's Name   "FIELD_NAME" and "comment"

      

0
4 comments

picture is always uploading failed

 

0

Jyf0231 Hi there! Thank you for your question. You can upload the file using this link - https://uploads.jetbrains.com/browse . Please share the upload ID here so that our team could check it. Also, having a file you're trying to make a template of might also be helpful.

Thank you!

0

Please sign in to leave a comment.