Skip to content

feat: LSP server for MDS #67

Description

@dean0x

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

  • mds-lsp binary starts and communicates via LSP protocol
  • Real-time diagnostics on file save/change
  • Variable and function completion
  • Go-to-definition for imports and functions
  • Hover info for variables and functions
  • VS Code extension uses the LSP server
  • Neovim configuration documented
  • Response time < 100ms for completions on files up to 1000 lines

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesttoolingEditor support, LSP, formatters

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions