You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
project demo is
package pretty_printer is
for default_switches ("ada") use
("--name-mixed-case",
"--dictionary=case_exceptions.txt");
end pretty_printer;
end demo;
with this case exception dictionary case_exceptions.txt
HTTP
ID
and this Ada source demo.adb
with ada.text_io;
with gnat.io;
with ada.containers.vectors;
procedure demo is
package vectors is new ada.containers.vectors
(index_type => natural, element_type => positive);
package http renames vectors;
subtype http_id is http.vector;
subtype id is positive;
begin
gnat.io.put_line ("test");
end demo;
With gnatpp 24.0.0, the formatted output is
$ gnatpp -Pdemo --pipe demo.adb
with Ada.Text_IO;
with GNAT.IO;
with Ada.Containers.Vectors;
procedure Demo is
package Vectors is new Ada.Containers.Vectors
(Index_Type => Natural, Element_Type => Positive);
package HTTP renames Vectors;
subtype Http_Id is HTTP.Vector;
subtype ID is Positive;
begin
GNAT.IO.Put_Line ("test");
end Demo;
where we see that http and id have been upcased, but http_id has merely been title-cased, whereas we’d have expected them to have been upcased too, as subwords.
With GNATStudio 25, as provided at Sourceforge by Blady, we get
with Ada.Text_IO;
with GNAT.IO;
with Ada.Containers.Vectors;
procedure Demo is
package Vectors is new Ada.Containers.Vectors
(Index_Type => Natural, Element_Type => Positive);
package Http renames Vectors;
subtype Http_Id is Http.Vector;
subtype Id is Positive;
begin
GNAT.IO.Put_Line ("test");
end Demo;
and neither http nor id has been upcased.
The same happens with ada-ts-mode, which is ALS-based.
If I alter case_exceptions.txt to what I believe to be an older way of specifying subwords
*HTTP*
*ID*
then gnatpp -Pdemo --pipe demo.adb gives
with Ada.Text_IO;
with GNAT.IO;
with Ada.Containers.Vectors;
procedure Demo is
package Vectors is new Ada.Containers.Vectors
(Index_Type => Natural, Element_Type => Positive);
package HTTP renames Vectors;
subtype HTTP_ID is HTTP.Vector;
subtype ID is Positive;
begin
GNAT.IO.Put_Line ("test");
end Demo;
(http and id are upcased everywhere! Great!)
GNATStudio gives
with Ada.Text_Io;
with Gnat.Io;
with Ada.Containers.Vectors;
procedure Demo is
package Vectors is new Ada.Containers.Vectors
(Index_Type => Natural, Element_Type => Positive);
package Http renames Vectors;
subtype Http_Id is Http.Vector;
subtype Id is Positive;
begin
Gnat.Io.Put_Line ("test");
end Demo;
(gnat, http, id, and io are title-cased).
ada-ts-mode gives
with Ada.Text_IO;
with GNAT.IO;
with Ada.Containers.Vectors;
procedure Demo is
package Vectors is new Ada.Containers.Vectors
(Index_Type => Natural, Element_Type => Positive);
package Http renames Vectors;
subtype Http_Id is Http.Vector;
subtype Id is Positive;
begin
GNAT.IO.Put_Line ("test");
end Demo;
(at least gnat and io are upcased).
The text was updated successfully, but these errors were encountered:
The current discrepancies are all explained under: #1216
To resume, the plan is to harmonize everything and rely only in the GNATformat engine in the future, baselining GNATpp and replacing GNAT Studio's current ad-hoc formatter by proper LSP formatting requests (which will use the GNATformat engine behind the scene).
Formatting gives different results, depending on the formatting tool used (gnatpp, gnatstudio, ada-ts-mode), particularly for subwords.
Using ALS 25.0.20241014 on aarch64 macOS Sequoia 15.0.1.
Source code in formatting_control.zip.
I have this project
demo.gpr
with this case exception dictionary case_exceptions.txt
and this Ada source demo.adb
With gnatpp 24.0.0, the formatted output is
where we see that
http
andid
have been upcased, buthttp_id
has merely been title-cased, whereas we’d have expected them to have been upcased too, as subwords.With GNATStudio 25, as provided at Sourceforge by Blady, we get
and neither
http
norid
has been upcased.The same happens with
ada-ts-mode
, which is ALS-based.If I alter
case_exceptions.txt
to what I believe to be an older way of specifying subwordsthen
gnatpp -Pdemo --pipe demo.adb
gives(
http
andid
are upcased everywhere! Great!)GNATStudio gives
(
gnat
,http
,id
, andio
are title-cased).ada-ts-mode
gives(at least
gnat
andio
are upcased).The text was updated successfully, but these errors were encountered: