Skip to content

feat: Zenzic Language Server (ZLS) Foundation & Diagnostic Engine#154

Merged
PythonWoods-Dev merged 3 commits into
mainfrom
feature/v0.21.0-zls-core
Jul 11, 2026
Merged

feat: Zenzic Language Server (ZLS) Foundation & Diagnostic Engine#154
PythonWoods-Dev merged 3 commits into
mainfrom
feature/v0.21.0-zls-core

Conversation

@PythonWoods-Dev

Copy link
Copy Markdown
Contributor

Objective

This PR implements Phases 1, 2, and 3 of the architecture for the Zenzic Language Server (ZLS), introducing native support for the JSON-RPC 2.0 protocol and resolving computational debt associated with keystroke-level execution overhead.

Resolves #12.

Key Changes

  • Zero-Dependency Transport Layer: Added the zenzic lsp CLI command which establishes JSON-RPC 2.0 communication over stdio without relying on external dependencies (pygls / lsprotocol).
  • Zero-DBT Incremental Synchronization: Implemented the DocumentManager (textDocumentSync = 2) which mathematically resolves the impedance mismatch between Python string indices and UTF-16 code units (safely handling Surrogate Pairs and Emojis).
  • Diagnostic Emission & Rule Engine: Connected the AdaptiveRuleEngine to the textDocument/publishDiagnostics notification, mapping line/character properties and structural severity levels.
  • Debounced Multiplexing (CPU Protection): To prevent CPU saturation ($O(N)$ parsing on every keystroke), implemented an I/O multiplexing loop using select.select(). State updates are applied instantly, but the engine defers execution until a 300ms debounce threshold of inactivity is met.
  • Architecture & Security: Added strict typing via PEP 484 TypedDict to enforce IPC schema compliance and guard against malformed payloads. Hardened memory hygiene by accurately purging AST states within the didClose event handler.

Documentation

  • Added an architectural chapter in docs/explanation/language-server-architecture.md detailing the UTF-16 incremental sync math and the single-threaded Debounce strategy.
  • Rotated the v0.20.x series Changelog into the archive and updated the SARIF snippet version in README.md.

- Hardened JSON-RPC layer with TypedDict and compliant parse error handling
- Implemented O(N) rule engine integration on the in-memory document state
- Decoupled state patching from diagnostic emission via manual 'select' buffering
- Solved architectural debt with a 300ms CPU-friendly debounce strategy
- Rotated CHANGELOG into v0.20.x archive and fixed .bumpversion.toml coverage
- Documented debounced emission model in architecture docs

Signed-off-by: PythonWoods-Dev <gianluca.catalano@gmail.com>
Signed-off-by: PythonWoods-Dev <gianluca.catalano@gmail.com>
Signed-off-by: PythonWoods-Dev <gianluca.catalano@gmail.com>
@PythonWoods-Dev PythonWoods-Dev merged commit 2054a5e into main Jul 11, 2026
7 checks passed
@PythonWoods-Dev PythonWoods-Dev deleted the feature/v0.21.0-zls-core branch July 11, 2026 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Zenzic LSP (Language Server Protocol)

1 participant