Commit Graph
12 Commits
Author SHA1 Message Date
lazar fed4dcf93a docs: add auto-editing features section to AGENTS.md 2026-02-21 01:50:39 +01:00
lazar 5282385e79 docs: update collapse patterns documentation in AGENTS.md 2026-02-20 23:53:55 +01:00
lazar dfa4ef3381 feat: add builtin types/functions to diagnostics and completions
Files Modified/Created:
- src/builtin_instructions.lua - NEW: Contains all TIA Portal built-in types, FBs, and functions
- src/diagnostics.lua - Added missing data types + builtin instruction checking
- src/main.lua - Added completion support for built-in types/F Bs/functions
- src/plc_json.lua - Added .db file parsing + BOM handling fixes
- lua/scl/blink_cmp_source.lua - Extended completion with all built-in types/F Bs/functions
- src/node-types.json - Added node types for parser
- AGENTS.md - Updated documentation
Features Added:
1. Diagnostics - No more false "Unknown data type" warnings for:
   - All elementary types (USINT, SINT, UINT, UDINT, LINT, ULINT, TOD, DTL, etc.)
   - Timer/counter types (IEC_TON, TOF, TP, CTU, CTD, CTUD)
   - TIA Portal built-in FBs and functions
2. Auto-completion - Shows in VAR section after ::
   - 28 elementary data types
   - 23 built-in function blocks (TON, TOF, TP, CTU, CTD, CTUD, R_TRIG, F_TRIG, etc.)
   - 80+ built-in functions (ADD, SUB, MUL, DIV, SIN, COS, SQRT, etc.)
2026-02-20 13:08:28 +01:00
lazar 40748bffd0 docs: add filetype detection section to AGENTS.md 2026-02-20 09:01:06 +01:00
lazar 577ffa5213 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 5b89157790 docs: document formatter collapseAttributes default change 2026-02-19 11:24:22 +01:00
lazar 3d9d1599b9 docs: document attr_toggle behavior after formatting 2026-02-19 11:18:16 +01:00
lazar 978e46ba45 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 96c0c4584f 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 4429280524 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 8a497a7e2b docs: Update AGENTS.md with comprehensive feature documentation 2026-02-17 15:30:30 +01:00
lazar 625297106e Inintal commit 2026-02-14 15:05:12 +01:00