Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
JHag6694 opened this issue Dec 14, 2023 · 0 comments
Open
Assignees
Labels

Comments

@JHag6694
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants