diff --git a/src/formatter.lua b/src/formatter.lua index 77cde74..78bc3fb 100644 --- a/src/formatter.lua +++ b/src/formatter.lua @@ -98,9 +98,12 @@ function M.format_document(content, options) local indent_char = use_spaces and string.rep(" ", indent_size) or "\t" -- Attribute block collapsing options + -- NOTE: Disabled by default to preserve compatibility with attr_toggle. + -- When formatter collapses blocks, the original content is lost. + -- Use :SCLCollapseAllAttrBlocks after formatting instead. local collapse_attributes = options.collapseAttributes if collapse_attributes == nil then - collapse_attributes = true -- Default: enabled + collapse_attributes = false -- Default: disabled to preserve toggle functionality end -- User can provide custom patterns or extend defaults @@ -531,7 +534,9 @@ function M.get_formatting_options() trimTrailingWhitespace = true, insertFinalNewline = true, trimFinalNewlines = true, - collapseAttributes = true, -- Collapse variable attribute blocks to {...} + collapseAttributes = false, -- Disabled by default to preserve toggle functionality + -- Set to true to enable automatic collapsing during formatting: + -- collapseAttributes = true, -- collapsePatterns = { ... }, -- Override default collapse patterns -- extendCollapsePatterns = { ... }, -- Extend default patterns with custom ones -- collapseVariableRules = { -- Per-variable collapse rules (highest priority)