16#FFFF (hex), 2#1010 (binary), 8#777 (octal) are TIA Portal
base-specific number literals, not hash-prefixed variables.
Check if the character before # is a digit to distinguish them.
SCL005 false positive triggered on:
timers{InstructionName := 'IEC_TIMER'; LibVersion := '1.0'}
These are valid TIA Portal attributes for IEC timer variables.
VCI-exported .scl files use all-caps attribute names (EXTERNALACCESSIBLE,
EXTERNALVISIBLE, EXTERNALWRITABLE) which were not in the allowed list,
triggering spurious SCL005 warnings.
diagnostics.lua:
- Add VAR DB_SPECIFIC to section detection
- Make all VAR/END_VAR detection case-insensitive (matches grammar)
- Replace 20-line hardcoded type check list with builtin.is_known_data_type()
and builtin.is_known_type_or_instruction() — now uses the expanded
DATA_TYPES table from Phase 4 instead of inline string comparisons
- Add attribute validation: warn on unknown per-variable attributes
(SCL005). Valid attributes: ExternalWritable, ExternalVisible,
ExternalAccessible, S7_SetPoint, S7_Optimized_Access
- Allow optional semicolon after END_VAR
parser.lua:
- Add VAR DB_SPECIFIC to section detection and var_type classification
- Make all block detection case-insensitive (FUNCTION_BLOCK, FUNCTION,
ORGANIZATION_BLOCK, END_FUNCTION_BLOCK, etc.)
- Make TYPE/END_TYPE, STRUCT/END_STRUCT, VAR/END_VAR case-insensitive
- Fix VAR RETAIN vs VAR NON_RETAIN classification (NON_RETAIN was
matching the RETAIN branch first)
- Allow optional semicolon after END_VAR and END_STRUCT
formatter.lua:
- Add VAR DB_SPECIFIC and VAR_DB_SPECIFIC to BLOCKS and VAR_KEYWORDS
- Fix get_keyword() to handle multi-word VAR keywords (VAR NON_RETAIN,
VAR DB_SPECIFIC, VAR CONSTANT, VAR RETAIN) — normalizes spaces to
underscores so the keyword lookup succeeds
- Fix is_new_statement detection for space-form VAR keywords
All 38 formatter tests pass. Parser and diagnostics load without errors.
Rename the project from scl_lsp to tia_lsp to future-proof for additional
TIA Portal languages (STL/AWL, LAD, FBD). The 'scl' language name is kept
as-is for the SCL filetype and tree-sitter parser; future languages get
their own names (stl, lad, fbd).
Project-wide changes:
- lua/scl_lsp/ → lua/tia_lsp/ (plugin entry point)
- lua/scl/ → lua/tia/ (language modules, shared across TIA langs)
- require('scl.*') → require('tia.*')
- require('scl_lsp') → require('tia_lsp')
- LSP client name: 'scl_lsp' → 'tia_lsp'
- Diagnostic source: 'scl_lsp' → 'tia_lsp' (src/diagnostics.lua)
- package.json name: 'scl-language-server' → 'tia-lsp'
lua/tia_lsp/init.lua:
- Add vim.fn.exepath('tia-lsp') detection so the plugin prefers the
mason-installed executable and falls back to { 'lua', server_path }
for manual installs.
- Add opts.ts_parser_url to configure the tree-sitter parser source.
- Remove hardcoded ~/dev/scl_lsp paths in favor of ~/dev/tia-lsp and
the new ts_parser_url option.
Cleanup:
- Delete lua/tia/init.lua (dead code, unreferenced duplicate of tia_lsp).
- Delete scl_lsp.sh (replaced by the mason-installed bin/tia-lsp wrapper).
- Update README.md and AGENTS.md to reflect the two-repo split
(tia-lsp server + tia-lsp.nvim plugin) and document Mason installation.
Unchanged (intentional):
- grammar.js, src/grammar.json, src/parser.c: tree-sitter language name
remains 'scl' (it's the language, not the project).
- Filetype patterns ('scl', 'udt', 'db') in autocmds.
- :SCL* command names (per-filetype prefix; future :STL* etc.).
Tests pass with the same pre-existing failures as before the rename
(formatter VAR_INPUT test, udt_parser line 199 const-variable bug,
plc_json reference-project-missing). No new failures introduced.
- SCLFormat: Remove clear_buffer_state() call that was preventing
expand after formatting (attr_toggle state now preserved)
- Diagnostics: Fix false 'Undefined variable' for IEC literals
like T#2s, D#1d, S5T#1s (TIME, DATE, S5TIME types)
- Formatter: Fix block comments (* ... *) being misidentified as
FB calls in VAR_IN_OUT/VAR_INPUT/VAR_OUTPUT sections
- Formatter: Fix array-based FB calls like instTimers[idx].TON()
not being properly formatted with aligned parameters
- 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
- 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