tenseleyflow/documentlanguagemodel / 355be96

Browse files

Add LSP cookbook entries for Zed, Helix, Neovim

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
355be96f37ad36fcb3c72f956007d2ee115e70b1
Parents
ea26a66
Tree
25dcde7

3 changed files

StatusFile+-
A docs/cookbook/lsp-helix.md 59 0
A docs/cookbook/lsp-neovim.md 66 0
A docs/cookbook/lsp-zed.md 62 0
docs/cookbook/lsp-helix.mdadded
@@ -0,0 +1,59 @@
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.
docs/cookbook/lsp-neovim.mdadded
@@ -0,0 +1,66 @@
1
+# Use DLM in Neovim
2
+
3
+The `dlm-lsp` language server attaches to Neovim through
4
+[`nvim-lspconfig`](https://github.com/neovim/nvim-lspconfig).
5
+
6
+## Install
7
+
8
+```bash
9
+pip install dlm-lsp
10
+which dlm-lsp   # confirm it's on PATH
11
+```
12
+
13
+## Configure
14
+
15
+Add to your Neovim config (Lua, e.g. `~/.config/nvim/lua/plugins/dlm.lua`
16
+or anywhere in your `init.lua`):
17
+
18
+```lua
19
+-- Recognize .dlm files
20
+vim.filetype.add({ extension = { dlm = "dlm" } })
21
+
22
+-- Register the LSP
23
+local lspconfig = require("lspconfig")
24
+local configs = require("lspconfig.configs")
25
+
26
+if not configs.dlm_lsp then
27
+  configs.dlm_lsp = {
28
+    default_config = {
29
+      cmd = { "dlm-lsp" },
30
+      filetypes = { "dlm" },
31
+      root_dir = lspconfig.util.find_git_ancestor,
32
+      single_file_support = true,
33
+      settings = {},
34
+    },
35
+  }
36
+end
37
+
38
+lspconfig.dlm_lsp.setup({})
39
+```
40
+
41
+If `dlm-lsp` isn't on your PATH (e.g. installed inside a venv), pass the
42
+absolute path:
43
+
44
+```lua
45
+cmd = { "/Users/you/.venvs/dlm/bin/dlm-lsp" },
46
+```
47
+
48
+## Verify
49
+
50
+Open a `.dlm` file. Run `:LspInfo` and confirm `dlm_lsp` is attached. If
51
+not, `:LspLog` shows the spawn error.
52
+
53
+You'll get:
54
+
55
+- Diagnostics through the standard Neovim diagnostic interface
56
+- Hover (`K`) on `base_model:` keys and section fences
57
+- Completion through your usual completion plugin
58
+  (`nvim-cmp`, `coq_nvim`, the built-in `Ctrl-x Ctrl-o`, etc.)
59
+- Code actions through `vim.lsp.buf.code_action()`
60
+
61
+## Optional: Tree-sitter highlighting
62
+
63
+Neovim uses Tree-sitter for highlighting. There is no `tree-sitter-dlm`
64
+parser yet; if you want richer highlighting before that lands, set the
65
+filetype to `markdown` for the body region and rely on LSP semantic
66
+tokens for the frontmatter and fence accents.
docs/cookbook/lsp-zed.mdadded
@@ -0,0 +1,62 @@
1
+# Use DLM in Zed
2
+
3
+The `dlm-lsp` language server is editor-agnostic. Zed picks it up through a
4
+custom language definition.
5
+
6
+## Install
7
+
8
+```bash
9
+pip install dlm-lsp
10
+which dlm-lsp   # confirm it's on PATH
11
+```
12
+
13
+## Configure
14
+
15
+Zed configures custom languages through `~/.config/zed/settings.json`:
16
+
17
+```json
18
+{
19
+  "languages": {
20
+    "DLM": {
21
+      "lsp": ["dlm-lsp"]
22
+    }
23
+  },
24
+  "lsp": {
25
+    "dlm-lsp": {
26
+      "binary": {
27
+        "path": "dlm-lsp",
28
+        "arguments": []
29
+      }
30
+    }
31
+  },
32
+  "file_types": {
33
+    "DLM": ["dlm"]
34
+  }
35
+}
36
+```
37
+
38
+If `dlm-lsp` isn't on your PATH (e.g. installed inside a venv), set
39
+`binary.path` to its absolute location:
40
+
41
+```json
42
+"binary": {
43
+  "path": "/Users/you/.venvs/dlm/bin/dlm-lsp",
44
+  "arguments": []
45
+}
46
+```
47
+
48
+## Verify
49
+
50
+Open any `.dlm` file in Zed. You should see:
51
+
52
+- Diagnostics on schema errors (red squiggles in frontmatter on bad keys)
53
+- Hover info on `base_model:` keys
54
+- Completions on the base-model registry
55
+
56
+The LSP log is reachable through the command palette → `zed: open log`.
57
+
58
+## Limitations vs. the VSCode extension
59
+
60
+Zed clients consume the LSP only — they don't render the side panel or
61
+quick-insert UI. For those, use the VSCode extension. Everything that's
62
+diagnostic, hover, completion, or code-action is fully available in Zed.