Inline variable declarations like this
try
var a := 2;
test(a);
finally
end;
are formatted as
try
var a:=2;
test(a);
finally
end;
The variable declaration should be indented to the same level as the code.
Adding 2 lines in 'GX_CodeFormatterFormatter.pas' at line 1633 fixes this problem:
end else if (FPrevToken.GetExpression(exp) and SameText(exp, 'for')) then begin
// for with inline var declaration
end else if (fStack.GetTopType = rtTry) then begin
// inline var declaration inside Try/finally block
end else begin
Report and patch from Miko330 in Delphi Praxis:
https://en.delphipraxis.net/topic/10565-problem-indent-with-inline-var-inside-tryfinally/
Modified patch applied and verified to fix the problem in revision #4109
Also added to formatter unit tests testfile_InlineVarInTryFinally1.pas, testfile_InlineVarInTryFinally2.pas and testfile_InlineVarInTryFinally3.pas in revision #4108