Project: aptanastudio
Issue APSTUD-4414: Ruby Formatter Not Indenting If Statements
Seems related to fixed issue APSTUD-3620. Proper formatting of if statements is inconsistent in that it sometimes works and doesn't. Below is an example of multiple 'if' statements failing to correctly format and one that does. 1) Open Aptana Studio 3, build: 3.0.8.201201201658 2) Open a ruby file and add the following code: {code:none} class Ball def update(time_delta) # Determine new x and y position of ball. @x += @x_velocity * time_delta @y += @y_velocity * time_delta # Keep the ball on the window. if @x < @image.width / 2 @x = @image.width / 2 @x_velocity = -@x_velocity end if @x > (@window.width - (@image.width / 2)) @x = (@window.width - (@image.width / 2)) @x_velocity = -@x_velocity end if @y < @image.height / 2 @y = @image.height / 2 @y_velocity = -@y_velocity end if @y > @window.height + (@image.height / 2) reset end end end {code} 3) Format (CTRL+Space or Source > Format) Actual Results (notice only the last 'if' statement is correctly indented): {code:none} class Ball def update(time_delta) # Determine new x and y position of ball. @x += @x_velocity * time_delta @y += @y_velocity * time_delta # Keep the ball on the window. if @x < @image.width / 2 @x = @image.width / 2 @x_velocity = -@x_velocity end if @x > (@window.width - (@image.width / 2)) @x = (@window.width - (@image.width / 2)) @x_velocity = -@x_velocity end if @y < @image.height / 2 @y = @image.height / 2 @y_velocity = -@y_velocity end if @y > @window.height + (@image.height / 2) reset end end end {code} Expected Results: {code:none} class Ball def update(time_delta) # Determine new x and y position of ball. @x += @x_velocity * time_delta @y += @y_velocity * time_delta # Keep the ball on the window. if @x < @image.width / 2 @x = @image.width / 2 @x_velocity = -@x_velocity end if @x > (@window.width - (@image.width / 2)) @x = (@window.width - (@image.width / 2)) @x_velocity = -@x_velocity end if @y < @image.height / 2 @y = @image.height / 2 @y_velocity = -@y_velocity end if @y > @window.height + (@image.height / 2) reset end end end {code}
Story points: 8