craft-ls is a Language Server Protocol implementation for *craft1 tools.
craft-ls enables editors that support the LSP to get quality of life improvements while working on *craft configuration files.
| Feature | Snapcraft | Rockcraft | Charmcraft1 |
|---|---|---|---|
| Diagnostics | ✅ | ✅ | ✅ |
| Documentation on hover | ✅ | ✅ | ✅ |
| Symbols | ✅ | ✅ | ✅ |
| Autocompletion | ✅ | ✅ | ✅ |
demo.mov
sudo snap install craft-ls --edgenix run github:Batalex/craft-lsUsing uv
uv tool install craft-lsUsing pipx
pipx install craft-ls# languages.toml
[[language]]
name = "yaml"
language-servers = ["craft-ls"]
[language-server.craft-ls]
command = "craft-ls"The Visual Studio Code extension can be installed right from the editor.
It requires a local craft-ls installation (see previous section).
If not automatically picked, you may configure it using the following key:
{
"craft-ls.serverPath": "/home/user/.local/bin/craft-ls"
}Add the following to your Neovim configuration (e.g., ~/.config/nvim/init.lua
or a plugin file):
vim.lsp.config("craft_ls", {
cmd = { "craft-ls" },
filetypes = { "yaml" },
root_markers = {
"snapcraft.yaml",
"rockcraft.yaml",
"charmcraft.yaml",
"snap",
".git",
},
})
vim.lsp.enable("craft_ls")