AdaCore / gnatstudio

GNAT Studio is a powerful and lightweight IDE for Ada and SPARK.
399 stars 52 forks source link

Auto-fix adds space at the wrong place for style check #145

Open zertovitch opened 1 year ago

zertovitch commented 1 year ago

Hereafter is a reproducer for the issue in title. A consequence is that it ruins the indentation, which can be annoying if auto-fix is applied on many cases at a time (via "Fix all simple style errors").

wrenched.adb:

with Ada.Text_IO;

procedure Wrenched is
   use Ada.Text_IO;
begin
   put_line("oh");
   --
   --  Apply the style fix to the following style errors:
   --
   --  main.adb:6:3: (style) bad casing of "Put_Line" declared at a-textio.ads:509
   --  main.adb:6:11: (style) space required
   --
   --  Result is ` Put_Line("oh");` instead of `Put_Line ("oh");`
   --
end Wrenched;

wrenched.gpr:

project Wrenched is

   for Object_Dir use "obj";
   for Main use ("wrenched.adb");
   for Create_Missing_Dirs use "True";

   package Compiler is
      for Switches ("ada") use ("-gnatytr");
   end Compiler;

end Wrenched;
AnthonyLeonardoGracio commented 1 year ago

Hello @zertovitch,

indeed, we can reproduce. Thanks for the report.

Regards,