forked from
stavola.xyz/mlf
A human-friendly DSL for ATProto Lexicons
1# Matt's Lexicon Format
2
3A human-friendly DSL for ATProto Lexicons
4
5*This is a work in progress, things are subject to break and change*
6
7## What it looks like
8
9```mlf
10record post {
11 text!: string constrained {
12 maxLength: 3000,
13 maxGraphemes: 300,
14 },
15 createdAt!: Datetime,
16 reply: replyRef,
17}
18
19def type replyRef = {
20 root!: com.atproto.repo.strongRef,
21 parent!: com.atproto.repo.strongRef,
22};
23```
24
25## Installation
26
27Right now you can only install mlf from source:
28
29### CLI Tool
30
31```bash
32# Install with all code generators (default: TypeScript, Go, Rust)
33cargo install --path mlf-cli --all-features
34
35# Install with only specific generators
36cargo install --path mlf-cli --no-default-features --features typescript,go
37
38# Install with JSON generation only
39cargo install --path mlf-cli --no-default-features
40```
41
42### Language Server
43
44For editor integration with real-time diagnostics:
45
46```bash
47# Build the language server
48cargo build --release -p mlf-lsp
49
50# The binary will be at: target/release/mlf-lsp
51```
52
53#### Editor Setup
54
55**VS Code**: Create an extension configuration:
56```json
57{
58 "languageServer": {
59 "module": "/path/to/mlf-lsp",
60 "args": [],
61 "filetypes": ["mlf"]
62 }
63}
64```
65
66**Neovim**: Add to your LSP config:
67```lua
68local lspconfig = require('lspconfig')
69local configs = require('lspconfig.configs')
70
71configs.mlf = {
72 default_config = {
73 cmd = { '/path/to/mlf-lsp' },
74 filetypes = { 'mlf' },
75 root_dir = lspconfig.util.root_pattern('mlf.toml', '.git'),
76 },
77}
78
79lspconfig.mlf.setup{}
80```
81
82**Helix**: Add to `languages.toml`:
83```toml
84[[language]]
85name = "mlf"
86scope = "source.mlf"
87file-types = ["mlf"]
88language-servers = ["mlf-lsp"]
89
90[language-server.mlf-lsp]
91command = "/path/to/mlf-lsp"
92```
93
94See [mlf-lsp/README.md](mlf-lsp/README.md) for more details.
95
96## Documentation
97
98Visit the [MLF website](https://mlf.lol/docs) for comprehensive documentation, guides, and examples.
99
100## Architecture
101
102Please review [ARCHITECTURE.md](ARCHITECTURE.md) for an overview of how the project is structured.
103
104## License
105
106MIT