Skip to content

Fix indentation for comment blocks #321

@xterao

Description

@xterao

When formatting consecutive line comments, indentation is not calculated properly.
Since newline characters are attached to the end of line comments, different control is needed compared to regular newline blocks.
Also, fix the positioning of line comments to align with the element directly below them.

               -- Loop Directive2:Nest1 
                 AND (/*%for emp : employeeList */
                      name = /*emp.name*/'name'
                      -- Condition Directive2:Nest2 Parent : %for : Loop Directive2
                        /*%if true */
                        /*# "AND" */ x = true
                        /*%end */ --Condition Directive2 :END
/** Condition Directive3:Nest2 Parent : %for */
                        /*%if emp_has_next */
                        -- Condition Directive4:Nest3 Parent : %if Condition Directive3
                          /*%if !emp.projects.equals() */

Expected behavior

                 -- Loop Directive2:Nest1 
                 AND (/*%for emp : employeeList */
                      name = /*emp.name*/'name'
                        -- Condition Directive2:Nest2 Parent : %for : Loop Directive2
                        /*%if true */
                        /*# "AND" */ x = true
                        /*%end */ --Condition Directive2 :END
                        /** Condition Directive3:Nest2 Parent : %for */
                        /*%if emp_has_next */
                           -- Condition Directive4:Nest3 Parent : %if Condition Directive3
                          /*%if !emp.projects.equals() */

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions