From b4293b4f30628e013c7f4ec18a240193d7e8e465 Mon Sep 17 00:00:00 2001 From: Lazar Bulovan Date: Fri, 24 Jul 2026 11:31:53 +0200 Subject: [PATCH] formatter: add DATA_BLOCK to BLOCKS + DECLARATIONS Without this, DATA_BLOCK wasn't recognized as a declaration block, so the stack was never populated for DB files. END_DATA_BLOCK fell through to regular-line handling and got a tab prefix (from body get_indent()), while DATA_BLOCK itself was flush-left. Added DATA_BLOCK to both BLOCKS (ender = END_DATA_BLOCK) and DECLARATIONS so it gets the same treatment as FUNCTION_BLOCK: stack cleared, no_indent=true, and END_DATA_BLOCK handled by the declaration ender path (flush-left output). --- src/formatter.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/formatter.lua b/src/formatter.lua index 4167333..eae5d06 100644 --- a/src/formatter.lua +++ b/src/formatter.lua @@ -43,6 +43,7 @@ local BLOCKS = { ["FUNCTION"] = "END_FUNCTION", ["FUNCTION_BLOCK"] = "END_FUNCTION_BLOCK", ["ORGANIZATION_BLOCK"] = "END_ORGANIZATION_BLOCK", + ["DATA_BLOCK"] = "END_DATA_BLOCK", ["TYPE"] = "END_TYPE", ["STRUCT"] = "END_STRUCT", ["VAR"] = "END_VAR", @@ -91,6 +92,7 @@ local DECLARATIONS = { ["FUNCTION"] = true, ["FUNCTION_BLOCK"] = true, ["ORGANIZATION_BLOCK"] = true, + ["DATA_BLOCK"] = true, ["TYPE"] = true, ["STRUCT"] = true, }