How do ignore lines from being formatted by the Ada extension in Visual Studio Code on Windows? The --!pp off and --!pp on comments I’ve used before don’t seem to work.
Also, before I’ve added this to the project GPR, which led to correct formatting, but this seems to be ignored:
package Pretty_Printer is
for Default_Switches ("ada") use (
"-M120", -- Line length
"-c0", -- Don't change comments.
"--no-separate-is",
"--no-separate-loop-then",
"-l2" -- Compact layout
);
end Pretty_Printer;
I’m battling with this in the context of Ada TS Mode.
AdaCore are moving to a new formatting engine GNAT Format, which
is opinionated
has fewer options
is the default formatting engine for (recent releases of) Ada Language Server
uses a GPR package Format
In VS Code there’s a Formatting setting 'Use Gnatformat`, which s ticked by default.
ALS includes the implementation of both formatting engines, but (at any rate for the PP version) it doesn’t seem to pass all the options through, so you don’t necessarily get the effect you want.
Thanks for pointing me in the right direction. I set up my Format package rule and opened a ticket with GNATformat about the situation I’m seeing. Overall it’s been good, I’d just like to be able to ignore some lines.