- Add in_condition state to track when inside IF/ELSIF condition (before THEN)
- Use condition_indent for continuation lines in conditions
- Fixes multiline IF/ELSIF conditions being incorrectly indented
- Add comprehensive formatter test suite with 38 tests
- Test multiline assignments, FB calls, control structures
- Test IF, FOR, WHILE, CASE, REPEAT statements
- Test regions, structs, var sections
- Update AGENTS.md with formatter test command
- Fix formatter to properly detect when multiline assignment ends
- Add check for line ending with := and ; before checking continuation
- Fixes issue where subsequent lines were incorrectly indented
- Fix formatter to detect continuation lines that don't start with
operators (e.g., #variable AND ... continuation lines)
- All continuation lines now align vertically after :=
- Format multi-line assignments with proper alignment
- Format FB calls in multiline style with parameter alignment
- Auto-expand collapsed attribute blocks before save
- Rename command from LspSCLFormat to SCLFormat
- Condense AGENTS.md and add testing section with reference project
- Skip // line comments when finding type separator colon
- Only match : that is NOT followed by = (avoid := assignment)
- Remove line comments from type_part before extraction
- Fixes false 'Unknown data type' warnings in VAR sections
- Add pattern matching for quoted type names like "MyUDT"
- Handle quoted types in ARRAY ... OF declarations
- Skip empty base_type to avoid spurious warnings
- Fix UDT TYPE parsing: don't clear pending_type_name on VERSION/TITLE lines
- Fix UDT field type extraction: handle attribute blocks before colon
- Add comment capture for UDT type definitions
- Add better error messages when member resolution fails
- Handle quoted type names in field declarations
- Fix chain detection to properly extract #var and member path
- Check all type sources (doc.types, external_types, builtins) for resolution
- Return helpful error messages when type resolution fails
- Prevent fallthrough to type check when member access is detected
- Show which type couldn't be found in resolution chain
- Add member access chain resolution in hover handler
- Parse #var.member.submember notation and resolve type chain
- Show member comments in hover tooltip
- Extract comments from UDT and DB file fields
- Combine all type sources (doc.types, external_types, builtin)
- Add type_definition rule for UDT files (TYPE/STRUCT/END_STRUCT/END_TYPE)
- Add data_block rule for DB files (DATA_BLOCK/BEGIN/END_DATA_BLOCK)
- Add NON_RETAIN and RETAIN modifiers support in data blocks
- Keywords now highlighted correctly in .udt and .db files
- extract_variables: Parse STRUCT fields in TYPE sections for .udt files
- extract_types: Handle quoted type names and multiple type definitions
- declaration handler: Extract quoted type names for goto declaration
- Add filetype detection for .udt and .db files in nvim config
Add referencesProvider capability and handler to support LSP
references (gr keybinding in LazyVim). Searches all occurrences
of a symbol in the current document.
The semantic tokens were causing 'Invalid line: out of range' errors
when opening certain files. This appears to be related to the delta
mode not being properly handled. Disabled semantic tokens for now
to prevent the errors.
- Wrap token generation in pcall to catch any errors
- Add validation for all token parameters (line, startChar, length)
- Validate deltaStart is non-negative
- Return empty tokens if any error occurs
- This should prevent the 'Invalid line: out of range' errors
The error 'Invalid line: out of range' was caused by semantic tokens
and inlay hints using variable line numbers that might be out of bounds
for the current document content. This could happen when the cached
variables from a previous document version have line numbers that don't
match the current content.
Added validation to both textDocument_semanticTokensFull and
textDocument_inlayHint to ensure line numbers are within the valid
range (0 to total_lines - 1) before processing.
When the formatter automatically collapses attribute blocks, the
original content is lost and cannot be restored by the toggle
module. This broke the attribute expand/collapse functionality.
Changed default from collapseAttributes = true to false.
Users who want collapsing should:
1. Use :LspSCLFormat to format (preserves original content)
2. Then use :SCLCollapseAllAttrBlocks to collapse (stores original)
3. Now toggle/expand works correctly because content is stored
The get_keyword() function was using pattern ^(%w+_%w+) which only
matched up to the second underscore, causing VAR_IN_OUT to be
extracted as VAR_IN. Since VAR_IN is not in VAR_KEYWORDS, the
VAR_IN_OUT block was not being pushed onto the stack.
Fixed by changing the pattern to ^([%w_]+) to capture the entire
keyword including all underscores.
This ensures variables inside VAR_IN_OUT, VAR_CONSTANT, and other
multi-underscore VAR sections are properly indented.
The parser was incorrectly finding the ':' inside attribute blocks like
{EXTERNALACCESSIBLE := 'false'} instead of the ':' after them.
Added 'break' after finding the first ':' outside braces to ensure
we get the correct type separator.
Fixes issue where variables like:
STARTING_BASEPOS : Int := 30;
were showing data_type as '= 30' instead of 'Int'.
Add documentation for new attribute block toggle feature including:
- New commands: SCLToggleAttrBlock, SCLExpandAllAttrBlocks, SCLCollapseAllAttrBlocks
- New keybindings: <Leader>xa, <Leader>xae, <Leader>xac
- Feature description and usage example
- Multi-line IF conditions: continuation lines at +1 from IF
- END_IF now decreases indent (reverted previous wrong change)
- Track multi-line condition state separately from THEN tracking
- Now matches TIA Portal expected format
- Track when IF has THEN on separate line
- Don't increase indent after IF until THEN is seen
- Increase indent after THEN for content
- Continuation lines in conditions stay at same level as IF
- END_IF stays at same level as content (TIA Portal style)
Per TIA Portal standard, END_IF stays at the same indent level as the
code inside the IF block, rather than decreasing. This matches the
reference file Em101Sequence.scl where nested END_IF statements are
properly aligned.
- Track first line of FB call separately with fb_call_first_line flag
- First line of FB call uses normal indent
- Continuation lines use continuation indent (base + fb_name_length + 2)
- Closing line uses normal indent
- Parameters now align correctly
- Use correct continuation indent formula (base + fb_name_length + 2)
- Fix closing line of FB call to use continuation indent
- Parameters on continuation lines are now aligned
- Re-indent comments to match current block level
- Add FB/function call continuation detection and alignment
- Support both #fbname and "FBName" syntax
- Fix FB call detection to exclude assignment statements
- Continuation lines get +1 indent level
- Default to tabs (not spaces) per TIA Portal standard
- Fix block keyword handling (IF, FOR, WHILE, CASE, REGION, etc.)
- Handle VAR section indentation (variables indented inside VAR)
- Fix IF/ELSIF/ELSE indentation (ELSIF/ELSE at same level as IF)
- Handle CASE labels and nested CASE statements
- Add missing semicolons after END_IF, END_FOR, END_CASE Handle block, etc.
- enders (END_IF, END_REGION, etc.) correctly
- Support compound keywords (END_IF, END_FUNCTION_BLOCK, etc.)
- Add db_parser.lua to parse .db files (DATA_BLOCK with VAR sections)
- Update workspace_types.lua to scan for .db files in project
- Update blink_cmp_source.lua to provide DB auto-completion:
- DB names available in general completion (without quotes)
- Type quote to get DB members
- Multi-level nested member access support
- Add DB count to workspace commands
- Update README with Global DB documentation