markdown · 1446 bytes Raw Blame History

Use DLM in Helix

The dlm-lsp language server attaches to Helix through languages.toml.

Install

pip install dlm-lsp
which dlm-lsp   # confirm it's on PATH

Configure

Add to ~/.config/helix/languages.toml:

[language-server.dlm-lsp]
command = "dlm-lsp"

[[language]]
name = "dlm"
scope = "source.dlm"
file-types = ["dlm"]
roots = []
comment-token = "#"
language-servers = ["dlm-lsp"]
indent = { tab-width = 2, unit = "  " }

If dlm-lsp isn't on your PATH (e.g. installed inside a venv), pass an absolute path:

[language-server.dlm-lsp]
command = "/Users/you/.venvs/dlm/bin/dlm-lsp"

Reload Helix or restart it for the language definition to register.

Verify

Open a .dlm file. Run :lsp-restart if completions don't appear right away, then check :log-open to confirm dlm-lsp started without errors.

You'll get:

  • Diagnostics on schema errors
  • Hover (K) on base_model: and section fences
  • Completions (Ctrl-x) for the base-model registry
  • Code actions (<space>a) where applicable

Optional: syntax highlighting

Helix uses Tree-sitter for highlighting, not TextMate, so the VSCode extension's grammar isn't reusable directly. The LSP semantic-token interface is the cleanest path; if you want richer highlighting, write a small Tree-sitter grammar that injects YAML for the frontmatter and Markdown for the body, then references the section fence as a custom node.

View source
1 # Use DLM in Helix
2
3 The `dlm-lsp` language server attaches to Helix through `languages.toml`.
4
5 ## Install
6
7 ```bash
8 pip install dlm-lsp
9 which dlm-lsp # confirm it's on PATH
10 ```
11
12 ## Configure
13
14 Add to `~/.config/helix/languages.toml`:
15
16 ```toml
17 [language-server.dlm-lsp]
18 command = "dlm-lsp"
19
20 [[language]]
21 name = "dlm"
22 scope = "source.dlm"
23 file-types = ["dlm"]
24 roots = []
25 comment-token = "#"
26 language-servers = ["dlm-lsp"]
27 indent = { tab-width = 2, unit = " " }
28 ```
29
30 If `dlm-lsp` isn't on your PATH (e.g. installed inside a venv), pass an
31 absolute path:
32
33 ```toml
34 [language-server.dlm-lsp]
35 command = "/Users/you/.venvs/dlm/bin/dlm-lsp"
36 ```
37
38 Reload Helix or restart it for the language definition to register.
39
40 ## Verify
41
42 Open a `.dlm` file. Run `:lsp-restart` if completions don't appear right
43 away, then check `:log-open` to confirm `dlm-lsp` started without errors.
44
45 You'll get:
46
47 - Diagnostics on schema errors
48 - Hover (`K`) on `base_model:` and section fences
49 - Completions (`Ctrl-x`) for the base-model registry
50 - Code actions (`<space>a`) where applicable
51
52 ## Optional: syntax highlighting
53
54 Helix uses Tree-sitter for highlighting, not TextMate, so the VSCode
55 extension's grammar isn't reusable directly. The LSP semantic-token
56 interface is the cleanest path; if you want richer highlighting, write a
57 small Tree-sitter grammar that injects YAML for the frontmatter and
58 Markdown for the body, then references the section fence as a custom
59 node.