mirror of
https://github.com/gogrlx/grlx-lsp.git
synced 2026-04-02 03:18:47 -07:00
96be450cb2473cd1ddcb8272d9b432b99dcc03c3
- Add completion_test.go: tests for top-level, ingredient.method, property, requisite type, and step ID completions - Add hover_test.go: tests for markdown generation, word extraction, and edge cases - Add diagnostics_test.go: tests for nil recipe, parse errors, empty ingredient, requisite validation, range helpers - Update all dependencies to latest versions - Add target/ to .gitignore (stale Rust build artifacts)
grlx-lsp
Language Server Protocol (LSP) server for 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
go install github.com/gogrlx/grlx-lsp/cmd/grlx-lsp@latest
Editor Setup
Neovim (nvim-lspconfig)
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:
{
"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:
include:
- apache
- .dev
steps:
install nginx:
pkg.installed:
- name: nginx
start nginx:
service.running:
- name: nginx
- requisites:
- require: install nginx
License
0BSD
Languages
Go
96.4%
Nix
3.6%