Skip to content

v0.4.0 Migrate to unified object-oriented symbol model (v0.4.0)

Choose a tag to compare

@Xilleet Xilleet released this 24 Oct 20:34
· 44 commits to main since this release

Refactor core & migrate to unified object-oriented symbol model

BREAKING CHANGE: Completely redesigned internal symbol storage from flat dictionaries
to typed object registries (VariableSymbol, LabelSymbol, ScreenSymbol, ImageSymbol).
Cache structure updated; bump engine version to 0.4.0.

Summary of changes:

  • Architecture:

    • Created senpy/symbols.py featuring dedicated dataclasses:
      VariableSymbol, LabelSymbol, ScreenSymbol, and ImageSymbol.
    • Refactored FileScope (models.py) and SenpyAnalyzer (analyzer.py),
      eliminating 13+ fragmented flat dictionaries and sets (declared_labels,
      declared_screens, symbol_declarations, symbol_types, defined_constants, etc.)
      in favor of 4 unified registries: variables, labels, screens, and images.
    • Streamlined _rebuild_aggregates() boilerplate by ~60%, drastically improving
      maintainability and reducing cache desynchronization risks.
  • Consumers & Integrations:

    • Refactored LSP Server (server.py) methods: completions, definition,
      hover, and document_symbols to directly consume the new symbol registries.
    • Updated Story Flow Analyzer (flow.py) and Mermaid graph export to inspect
      LabelSymbol properties directly.
    • Modernized checkers.py, python_ast.py, wiki.py, stubs.py, and cache.py
      to work natively with object models.
  • Reliability & PEP 8:

    • Replaced broad contextlib.suppress(Exception) with specific, narrowed
      exception tuples (SyntaxError, ValueError, TypeError, OSError, pickle.PickleError, zlib.error)
      in signature.py and cli.py.
  • Tests:

    • Updated test assertions across tests/test_analyzer.py and tests/test_lsp.py.
    • All 54 test suites passing cleanly (0.90s).