A human-friendly DSL for ATProto Lexicons
Rust 77%
C 16%
JavaScript 2%
SCSS 2%
1%
HTML 1%
C++ 1%
Just <1%
Tree-sitter Query <1%
Shell <1%
Python <1%
TypeScript <1%

README.md

Matt's Lexicon Format #

A human-friendly DSL for ATProto Lexicons

This is a work in progress, things are subject to break and change

What it looks like #

/// Blog-style post record for the Bluesky feed.
@const("revision", 3)
self {}

record post {
    text!: string constrained {
        maxLength: 3000,
        maxGraphemes: 300,
    },
    createdAt!: Datetime,
    reply: replyRef,
}

def type replyRef = {
    root!: com.atproto.repo.strongRef,
    parent!: com.atproto.repo.strongRef,
};

self {} represents the lexicon itself — docs on it map to the top-level description; @const / @reference annotations carry non-spec or vendor extension fields through to JSON.

Installation #

Right now you can only install mlf from source:

CLI Tool #

# Install with all code generators (default: TypeScript, Go, Rust)
cargo install --path mlf-cli --all-features

# Install with only specific generators
cargo install --path mlf-cli --no-default-features --features typescript,go

# Install with JSON generation only
cargo install --path mlf-cli --no-default-features

Language Server #

For editor integration with real-time diagnostics:

# Build the language server
cargo build --release -p mlf-lsp

# The binary will be at: target/release/mlf-lsp

Editor Setup #

VS Code: Create an extension configuration:

{
  "languageServer": {
    "module": "/path/to/mlf-lsp",
    "args": [],
    "filetypes": ["mlf"]
  }
}

Neovim: Add to your LSP config:

local lspconfig = require('lspconfig')
local configs = require('lspconfig.configs')

configs.mlf = {
  default_config = {
    cmd = { '/path/to/mlf-lsp' },
    filetypes = { 'mlf' },
    root_dir = lspconfig.util.root_pattern('mlf.toml', '.git'),
  },
}

lspconfig.mlf.setup{}

Helix: Add to languages.toml:

[[language]]
name = "mlf"
scope = "source.mlf"
file-types = ["mlf"]
language-servers = ["mlf-lsp"]

[language-server.mlf-lsp]
command = "/path/to/mlf-lsp"

See mlf-lsp/README.md for more details.

Documentation #

Visit the MLF website for comprehensive documentation, guides, and examples.

Architecture #

Please review ARCHITECTURE.md for an overview of how the project is structured.

License #

MIT