Skip to content

Blank line between message comments and message caused an offset in the property/element comments #713

@ehallander9591

Description

@ehallander9591

protobuf.js version: <6.6.5>

I had gotten used to using the generated jsdocs for my protobuf objects, and then came across an generation error that I just couldn't see the forest through the trees for a long time. The comment on a particular attribute, which alphabetically was the first attribute in the object documentation, had the default comment, when I was pretty sure the source .proto file had a /// comment. Long story short, it turned out that the message /** ... */ comment had a blank line after it, and what that did was offset all the attribute comments by 1 as show in this simple example.

syntax = "proto3";

package issue;

/**
 * Message Comment
 */

message SomeMessage {
    string field1 = 1; /// This is Field 1
   string field2 = 2; /// This is Field 2

   string cField1 = 3; /// Should be the second field
   string alphabeticallyFirstField = 4; /// Comment for alphabeticallyFirstField 
}
        /**
         * SomeMessage field1.
         * @type {string}
         */
        SomeMessage.prototype.field1 = "";

        /**
         * This is Field 1
         * @type {string}
         */
        SomeMessage.prototype.field2 = "";

        /**
         * SomeMessage cField1.
         * @type {string}
         */
        SomeMessage.prototype.cField1 = "";

        /**
         * Should be the second field
         * @type {string}
         */
        SomeMessage.prototype.alphabeticallyFirstField = "";

<please paste the stack trace of the error if applicable>

Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions