For those wondering about source code formatting with Gnat Studio 2026.2

This is my personal information gathering and may be wrong so take it with a pinch of salt.

Under edit preferences there is LSP => semantic highlighting as an option bringing much more colours that can be set under Editor => Fonts & Colors.

There is also Editor => Ada => Formatter on enter and Editor => Ada Formatter for range formatting which can both be set to LSP. It seems pretty solid so far and works when a package has with Abstract_State that would prevent the old formatter working.

The news is that the new formatter mentioned here

is opinionated as described here

Personally I think this may be a good thing for more reliable tooling and consistent formatting. I actually preferred the below Pretty_Printer options which I suppose are no longer relevant. The opinionated behaviour is described in 6.1 of the above link. I preferred that procedures always used multiple lines even if the procedure didn’t reach the line length/80 characters but it’s not a big deal.

procedure Set_Heading
  (Source : String;
   Count : Natural);

vs

procedure Set_Heading (Source : String; Count : Natural);
                                        "--call-threshold=1",
                                        "--par-threshold=1",
                                        "--no-compact",
                                        "--vertical-enum-types",
                                        "--vertical-named-aggregates",
                                        "--vertical-array-Types",
                                        "--vertical-case-Alternatves",
1 Like

I dislike opinionated formatters when they have the wrong opinions. I’ve been told that GNATformat will eventually gain some more options. Until then, keep a recent copy of gnatpp on your PATH. GNATpp still works fine although I’m not sure if it is directly supported in the new GNAT Studio. You can always create a custom GNAT Studio “build target” to run gnatpp.

Main problem here is that the “opinion” is even inconsistent between gnatformat from Alire and what the LSP does.

I believe they’re aiming to match this as stated in the above gnatformat link.