A human-friendly DSL for ATProto Lexicons
Rust 84.6%
JavaScript 3.6%
SCSS 2.9%
HTML 1.5%
Just 0.5%
Scheme 0.2%
Shell 0.1%
C++ 0.1%
Python 0.1%
Other 6.3%
47 1 0

Clone this repository

https://tangled.org/stavola.xyz/mlf
git@tangled.org:stavola.xyz/mlf

For self-hosted knots, clone URLs may differ based on your setup.

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#

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,
};

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