feat: add interactive attribute block toggle with keybindings and commands

Add ability to expand/collapse SCL variable attribute blocks like {EXTERNALACCESSIBLE := 'false'} to {...}

Features:
- Per-variable collapse rules via collapseVariableRules option
- Interactive toggle with <Leader>xa keybinding
- Commands: SCLToggleAttrBlock, SCLExpandAllAttrBlocks, SCLCollapseAllAttrBlocks
- Keybindings: <Leader>xa (toggle), <Leader>xae (expand all), <Leader>xac (collapse all)
- Supports both formatter-collapsed and manually collapsed blocks

Also update AGENTS.md with new documentation and troubleshooting guide
This commit is contained in:
2026-02-19 10:12:58 +01:00
parent 37ab917422
commit 978e46ba45
4 changed files with 377 additions and 125 deletions
+14 -3
View File
@@ -78,15 +78,26 @@ function M.extract_variables(content)
return
end
local var_name = trimmed:match("^([%w_]+)%s*:")
local var_name = trimmed:match("^([%w_]+)%s*%b{}%s*:") or trimmed:match("^([%w_]+)%s*:")
if not var_name then
var_name = trimmed:match("^([%w_]+)%s*,")
var_name = trimmed:match("^([%w_]+)%s*%b{}%s*,") or trimmed:match("^([%w_]+)%s*,")
end
if var_name and not variables[var_name] then
local col = line:find(var_name, 1, true)
if col then
local type_start = line:find(":", 1, true)
local type_start = nil
local brace_depth = 0
for i = 1, #line do
local c = line:sub(i, i)
if c == "{" then
brace_depth = brace_depth + 1
elseif c == "}" then
brace_depth = brace_depth - 1
elseif c == ":" and brace_depth == 0 then
type_start = i
end
end
local var_data_type = "unknown"
if type_start then
local type_part = line:sub(type_start + 1)