Skip to content

Format: With "--source-line-breaks" switch, result is sometimes incorrect #1175

@JHag6694

Description

@JHag6694

With switch "--source-line-breaks" activated in Pretty_Printer package, I face 2 problems when formating code with comments

  1. "Format Selection" on a comment line delete 2 trailing characters

  2. "Format Document" shift case / if instructions when preceded with a comment line.

Source example:

-- TOP OF FILE with Ada.Text_Io; package body Messages is use type Ada.Text_Io.Count; First_Hello : Boolean := False; -- #2 : 'Format selection' on this comment line delete 2 trailing chars procedure Hello_Hello is null; procedure You_Say_Hello is begin -- #3 : This comment makes the case instruction is right shifted on 'format document' case First_Hello is when True => Ada.Text_Io.Put_Line ("Hello"); when False => Ada.Text_Io.Put_Line ("Hello again"); end case; end; procedure I_Say_Goodbye is begin case First_Hello is when True =>null; when False =>Ada.Text_Io.Put_Line ("Goodbye"); end case; end; end Messages; 

Full source code and project settings to reproduce the issue: https://github.com/JHag6694/AdaTest

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions