Summary
Build a Language Server Protocol (LSP) implementation for MDS, providing real-time diagnostics, completions, go-to-definition, hover info, and more across all editors that support LSP.
Motivation
An LSP server is the "makes MDS feel like a real language" feature. It provides:
- Real-time error diagnostics as you type (no need to run
mds check)
- Autocomplete for variable names, function names, and import paths
- Go-to-definition for
@import paths and function calls
- Hover info showing variable types/values and function signatures
- Rename symbol across files
- Find references for variables and functions
This is the flagship developer experience investment and benefits every editor simultaneously (VS Code, Neovim, Helix, Zed, Emacs, Sublime Text, JetBrains).
Scope
Phase 1 — Core Features
- Diagnostics (delegate to
mds check + lint rules)
- Completion for frontmatter variables, defined functions, imported symbols
- Go-to-definition for
@import paths, function definitions
- Hover info for variables (show value/type) and functions (show signature)
Phase 2 — Advanced Features
- Workspace-wide diagnostics (all
.mds files, not just the open one)
- Rename symbol (variables, functions) across files
- Find all references
- Code actions (quick fixes for common lint warnings)
- Signature help (parameter hints during function calls)
Phase 3 — Integration
- Document formatting (delegates to
mds fmt)
- Document symbols (outline view)
- Folding ranges
- Semantic tokens (richer highlighting than TextMate/Tree-sitter)
Design Considerations
- Implementation: Rust, using the
tower-lsp crate (standard Rust LSP framework)
- Crate: New
crates/mds-lsp in the workspace
- Distribution: Standalone binary (
mds-lsp) + bundled in the VS Code extension
- Incremental: The LSP must be responsive — reparse only changed regions, cache module resolutions
- Configuration: Reads
mds.json for project settings, respects lint rule configuration
- Testing: LSP protocol-level tests using
tower-lsp-testing or similar
Acceptance Criteria
Summary
Build a Language Server Protocol (LSP) implementation for MDS, providing real-time diagnostics, completions, go-to-definition, hover info, and more across all editors that support LSP.
Motivation
An LSP server is the "makes MDS feel like a real language" feature. It provides:
mds check)@importpaths and function callsThis is the flagship developer experience investment and benefits every editor simultaneously (VS Code, Neovim, Helix, Zed, Emacs, Sublime Text, JetBrains).
Scope
Phase 1 — Core Features
mds check+ lint rules)@importpaths, function definitionsPhase 2 — Advanced Features
.mdsfiles, not just the open one)Phase 3 — Integration
mds fmt)Design Considerations
tower-lspcrate (standard Rust LSP framework)crates/mds-lspin the workspacemds-lsp) + bundled in the VS Code extensionmds.jsonfor project settings, respects lint rule configurationtower-lsp-testingor similarAcceptance Criteria
mds-lspbinary starts and communicates via LSP protocol