Commit Graph
19 Commits
Author SHA1 Message Date
lazar 35eae17f4f feat(lsp): add goto declaration for FB, DB, and UDT types
- Add declaration provider (gD) that finds definitions for:
  - Functions in .scl files
  - Function Blocks (FB) in .scl files
  - Data Blocks (DB) in .scl and .db files
  - User-Defined Types (UDT) in .scl and .udt files
- Implement project root detection for cross-directory searches
- Add duplicate location filtering to prevent multiple results
- Load UDT types from .udt files in plc_json
- Update documentation with goto declaration feature
2026-02-19 18:01:30 +01:00
lazar e0db21381a docs(README): clarify formatter attribute collapsing behavior 2026-02-19 11:24:45 +01:00
lazar 212d4b710d docs: document formatter collapseAttributes default change 2026-02-19 11:24:22 +01:00
lazar b663fd6b4b docs: document attr_toggle behavior after formatting 2026-02-19 11:18:16 +01:00
lazar becf45d348 fix: clear attr_toggle state after formatting
When :LspSCLFormat is used, line numbers and positions change,
but the attr_toggle module stores state based on old positions.
This caused toggle/expand/collapse to not work after formatting.

Now clears the attr_toggle buffer state after formatting so that
users can collapse blocks fresh after formatting.
2026-02-19 11:17:59 +01:00
lazar 35bf9ab781 Merge branch 'feat/scl_formatter' into develop 2026-02-19 10:24:38 +01:00
lazar ce1e27a42d docs: update README with attribute block toggle feature
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
2026-02-19 10:13:43 +01:00
lazar 74e521fe04 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
2026-02-19 10:12:58 +01:00
lazar 246fa85442 fix(lsp): Fix LSP server attachment and JSON parsing issues
- Replace lspconfig.scl_lsp registration with vim.lsp.start() + FileType autocmd
  for Neovim 0.11+ compatibility
- Fix Lua reserved keyword 'end' in tables (use bracket notation ['end'])
- Fix JSON decoder pattern matching bugs (s:find -> s:sub:match)
- Add LSP method name conversion (textDocument/didOpen -> textDocument_didOpen)
- Handle request vs notification correctly (only respond to requests with id)
- Strip CRLF line endings for Windows compatibility
- Add semantic token handler aliases
- Update documentation with implementation notes
2026-02-18 13:03:14 +01:00
lazar b5d50384fb docs(AGENTS.md): Update AGENTS.md
The new AGENTS.md includes:
- Reference project for testing
- Build/test commands (LSP and tree-sitter)
- Condensed project structure
- Code style guidelines (module pattern, naming, imports, comments)
- Parser module API convention
- Cache management patterns
- Error handling patterns (return pattern, pcall, validation)
- Completion system documentation
- Commands table
2026-02-18 10:25:35 +01:00
lazar a79082b64e fix(multiline_paras): <Tab> behavior outside of fb/function
The function searches for := or => patterns anywhere in the code,
without verifying that the cursor is inside an FB/Function call context

Added is_inside_fb_call() function (lines 133-176):
- Traces backwards from cursor position
- Tracks parenthesis depth to skip nested calls
- Finds the opening ( of an FB call and checks if the name before it is a known variable
- Returns true only if cursor is inside an FB/Function call

Modified jump_to_next_param() (lines 178-189):
- Now returns false immediately if not inside an FB call context
- This causes the keymap to fall back to normal <Tab> behavior

Result:
- Inside FB call: <Tab> jumps to next := or =>
- Outside FB call: <Tab> behaves normally (inserts tab character)
2026-02-18 10:04:41 +01:00
lazar 1e50b596de fix(blink_cmp_source): Handling of DB patterns after operators
The completion now correctly handles DB patterns after any operator
(:=, =>, =, <>, >=, <=, >, <, AND, OR, NOT) by finding the last operator
and only matching DB patterns in the active portion after it.
2026-02-18 09:21:38 +01:00
lazar 7d54578406 docs: Update AGENTS.md with comprehensive feature documentation 2026-02-17 15:30:30 +01:00
lazar 8933b9315d Merge branch 'feat/db_workspace_scope_recognition' into develop 2026-02-17 15:22:05 +01:00
lazar 7db896b84c feat: Add Global Data Block recognition in workspace scope
- 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
2026-02-17 15:06:36 +01:00
lazar a3ea6e6c0a Add multiline params documentation 2026-02-17 12:36:17 +01:00
lazar c1500f954b Fix multiline params feature and auto-prefix
- Fix FB/function call parameter detection to prevent incorrect # prefixing
- Preserve # prefix when filling multiline params
- Add comma after first parameter and closing bracket on last param line
- Fix Tab navigation to position cursor after :=/=> operators
- Clean up dead code in multiline_params.lua
- Add setup functions for multiline params feature in both scl and scl_lsp
2026-02-17 12:34:59 +01:00
lazar 802fe93fb7 Added .gitignore 2026-02-14 15:06:54 +01:00
lazar fbbd357ee2 Inintal commit 2026-02-14 15:05:12 +01:00