Files
grlx-lsp/README.md
Tai Groot d5a9585c58 feat: grlx LSP server in Go
LSP server for grlx recipe files (.grlx) providing:

- Completion for ingredients, methods, properties, requisite types,
  and step ID references
- Diagnostics for unknown ingredients/methods, missing required
  properties, unknown properties, and invalid requisite types
- Hover documentation for all ingredients and methods with property
  tables
- Full schema for all 6 grlx ingredients (cmd, file, group, pkg,
  service, user) with accurate properties from the grlx source
2026-03-06 09:14:10 +00:00

92 lines
2.0 KiB
Markdown

# grlx-lsp
Language Server Protocol (LSP) server for [grlx](https://github.com/gogrlx/grlx) recipe files (`.grlx`).
## Features
- **Completion** — ingredient.method names, property keys, requisite types, step ID references
- **Diagnostics** — unknown ingredients/methods, missing required properties, unknown properties, invalid requisite types
- **Hover** — documentation for ingredients, methods, properties, and requisite types
## Installation
```bash
go install github.com/gogrlx/grlx-lsp/cmd/grlx-lsp@latest
```
## Editor Setup
### Neovim (nvim-lspconfig)
```lua
vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, {
pattern = "*.grlx",
callback = function()
vim.bo.filetype = "grlx"
end,
})
local lspconfig = require("lspconfig")
local configs = require("lspconfig.configs")
configs.grlx_lsp = {
default_config = {
cmd = { "grlx-lsp" },
filetypes = { "grlx" },
root_dir = lspconfig.util.find_git_ancestor,
settings = {},
},
}
lspconfig.grlx_lsp.setup({})
```
### VS Code
Create `.vscode/settings.json`:
```json
{
"files.associations": {
"*.grlx": "yaml"
}
}
```
Then configure a generic LSP client extension to run `grlx-lsp` for the `grlx` file type.
## Supported Ingredients
| Ingredient | Methods |
|-----------|---------|
| `cmd` | run |
| `file` | absent, append, cached, contains, content, directory, exists, managed, missing, prepend, symlink, touch |
| `group` | absent, exists, present |
| `pkg` | cleaned, group_installed, held, installed, key_managed, latest, purged, removed, repo_managed |
| `service` | disabled, enabled, masked, restarted, running, stopped, unmasked |
| `user` | absent, exists, present |
## Recipe Format
grlx recipes are YAML files with Go template support:
```yaml
include:
- apache
- .dev
steps:
install nginx:
pkg.installed:
- name: nginx
start nginx:
service.running:
- name: nginx
- requisites:
- require: install nginx
```
## License
0BSD