Skip to content

feat(lsp): add language server protocol implementation - #8

Merged
timoschenko merged 1 commit into
masterfrom
feat-lsp-init
Nov 14, 2026
Merged

timoschenko merged 1 commit into
masterfrom
feat-lsp-init

Conversation

@timoschenko

Copy link
Copy Markdown
Owner

Implement the Language Server Protocol (LSP 3.17) for dml, providing editor integration with real-time syntax diagnostics and Go-to-Definition.

Key changes:

  • cmd/dmlsp: Add stdio LSP 3.17 server CLI with configurable logging, preview notice, and graceful shutdown.
  • pkg/lsp:
    • Server: Implement JSON-RPC lifecycle (initialize, shutdown, exit) and document sync (didOpen, didChange, didSave, didClose).
    • FsCache: Provide in-memory document overlay with incremental/full edit application, hash-guarded AST caching, and disk fallback via lookup.Cache.
    • Diagnose: Generate ANTLR-based syntax diagnostics with debounced publishing and UTF-16 code unit offset alignment.
    • ResolveDefinition: Resolve definitions across imports (relative, versioned, transitive), templates, object hierarchy (parent, this.parent), dev. members, parameters, and methods.
  • pkg/dmlex/imports.go: Extract shared import parsing (ExtractDmlFileMeta) and path resolution (ResolveImportPath) for reuse across dmlfmt and dmlsp.
  • doc/lsp: Add setup guides for Neovim, VS Code, and Zed, along with feature overviews and protocol compatibility specifications.
  • test/lsp: Add integration test suites covering lifecycle, document synchronization, diagnostics debouncing/caching, and definition resolution.

Implement the Language Server Protocol (LSP 3.17) for dml,
providing editor integration with real-time syntax diagnostics
and Go-to-Definition.

Key changes:
- `cmd/dmlsp`: Add stdio LSP 3.17 server CLI with configurable logging, preview notice, and graceful shutdown.
- `pkg/lsp`:
  - `Server`: Implement JSON-RPC lifecycle (`initialize`, `shutdown`, `exit`) and document sync (`didOpen`, `didChange`, `didSave`, `didClose`).
  - `FsCache`: Provide in-memory document overlay with incremental/full edit application, hash-guarded AST caching, and disk fallback via `lookup.Cache`.
  - `Diagnose`: Generate ANTLR-based syntax diagnostics with debounced publishing and UTF-16 code unit offset alignment.
  - `ResolveDefinition`: Resolve definitions across imports (relative, versioned, transitive), templates, object hierarchy (`parent`, `this.parent`), `dev.` members, parameters, and methods.
- `pkg/dmlex/imports.go`: Extract shared import parsing (`ExtractDmlFileMeta`) and path resolution (`ResolveImportPath`) for reuse across `dmlfmt` and `dmlsp`.
- `doc/lsp`: Add setup guides for Neovim, VS Code, and Zed, along with feature overviews and protocol compatibility specifications.
- `test/lsp`: Add integration test suites covering lifecycle, document synchronization, diagnostics debouncing/caching, and definition resolution.
@timoschenko timoschenko self-assigned this Nov 14, 2026
@timoschenko
timoschenko merged commit 05b3da1 into master Nov 14, 2026
2 checks passed
@timoschenko
timoschenko deleted the feat-lsp-init branch November 14, 2026 23:17
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.

1 participant