File tree Expand file tree Collapse file tree 3 files changed +23
-4
lines changed
client/testFixture/formatter Expand file tree Collapse file tree 3 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -167,3 +167,11 @@ submit;
167167 end
168168endsubmit;
169169run ;
170+
171+ proc python ;
172+ /* comment */
173+ i;
174+ print('hello' )
175+ endinteractive;
176+ /* comment */
177+ run ;
Original file line number Diff line number Diff line change @@ -157,4 +157,12 @@ submit;
157157 end
158158 end
159159endsubmit;
160+ run ;
161+
162+ proc python ;
163+ /* comment */
164+ i;
165+ print('hello' )
166+ endinteractive;
167+ /* comment */
160168run ;
Original file line number Diff line number Diff line change @@ -119,16 +119,19 @@ const preserveProcs = (
119119 model : Model ,
120120) => {
121121 // should not format python/lua, treat it as raw data
122+ const lastStatement =
123+ region . children . length >= 2 &&
124+ region . children [ region . children . length - 1 ] . children ;
122125 if (
123126 current === - 1 &&
124127 region . block ?. name === "PROC" &&
125- region . children . length === 2 &&
128+ lastStatement &&
126129 region . children [ 0 ] . children . length > 0 &&
127- region . children [ 1 ] . children . length > 1 &&
130+ lastStatement . length > 1 &&
128131 "text" in region . children [ 0 ] . children [ 1 ] &&
129132 / ^ ( p y t h o n | l u a ) $ / i. test ( region . children [ 0 ] . children [ 1 ] . text ) &&
130- "text" in region . children [ 1 ] . children [ 0 ] &&
131- / ^ ( s u b m i t | i n t e r a c t i v e ) $ / i. test ( region . children [ 1 ] . children [ 0 ] . text )
133+ "text" in lastStatement [ 0 ] &&
134+ / ^ ( s u b m i t | i n t e r a c t i v e | i ) $ / i. test ( lastStatement [ 0 ] . text )
132135 ) {
133136 current = 0 ;
134137 }
You can’t perform that action at this time.
0 commit comments