Jedi Code Format: Indent try..finally..except blocks better. Issue #39989, patch by Domingo Galmés.

This commit is contained in:
Juha 2022-11-06 23:25:08 +02:00
parent 0ac5d3a4ce
commit 2d95dc76d7

View File

@ -115,14 +115,26 @@ begin
lcNode := TParseTreeNode(pcNode);
case lcNode.NodeType of
nBlock, nCaseStatement,
nIfBlock, nTryBlock, nFinallyBlock, nExceptBlock,
nRepeatStatement, nWhileStatement, nForStatement,
nWithStatement, nOnExceptionHandler, nInitSection:
nBlock, nCaseStatement, nIfBlock, nRepeatStatement, nWhileStatement,
nForStatement, nWithStatement, nOnExceptionHandler, nInitSection:
begin
leNestType := nlBlock;
lbHasNesting := True;
end;
nTryBlock, nFinallyBlock, nExceptBlock:
begin
//if a=b then
//try
// writeln();
//finally
//end;
// only indent try block if it is in begin end block.
if lcNode.HasParentNode(nCompoundStatement,4) then
begin
leNestType := nlBlock;
lbHasNesting := True;
end;
end;
nElseBlock:
begin
{ if the else is immediately followed by if then it is not a block indent }