Repository navigation
feat(lsp): add language server protocol implementation - #8
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 vialookup.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 acrossdmlfmtanddmlsp.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.