docs: encourage adding comments; fix nested IF/ELSIF indentation

- Update AGENTS.md to encourage comments instead of forbidding them
- Add docstrings to all public functions in src/ modules
- Add module headers and function comments to lua/scl/ modules
- Fix formatter to properly indent multi-line IF/ELSIF conditions
- Fix FB call detection to not match IF statements with parentheses
This commit is contained in:
2026-02-23 17:40:44 +01:00
parent db69592cc1
commit 37f8d475f0
9 changed files with 301 additions and 18 deletions
+12
View File
@@ -1,6 +1,12 @@
-- SCL Parser utilities for the LSP server
-- Extracts variables, types, and function definitions from SCL source code
local M = {}
--- Extract variables from SCL content
--- @param content string The SCL source code
--- @return table variables Table of variable definitions keyed by name
--- @return table variable_positions Table of variable positions keyed by name
function M.extract_variables(content)
local variables = {}
local variable_positions = {}
@@ -164,6 +170,9 @@ function M.extract_variables(content)
return variables, variable_positions
end
--- Extract type definitions from SCL content
--- @param content string The SCL source code
--- @return table types Table of type definitions keyed by name
function M.extract_types(content)
local types = {}
@@ -285,6 +294,9 @@ function M.extract_types(content)
return types
end
--- Extract function/block definitions from SCL content
--- @param content string The SCL source code
--- @return table functions Array of function definitions with name, kind, start, final
function M.extract_functions(content)
local functions = {}