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
Using uv or pipx
uv tool install craft-ls
pipx install craft-ls# languages.toml
[[language]]
name = "yaml"
language-servers = ["craft-ls"]
[language-server.craft-ls]
command = "craft-ls"The VSCode extension can be installed from the marketplace. It requires a Python 3.12 interpreter. If not automatically picked, you may configure it using the following key:
"craft-ls.interpreter": [
"/usr/bin/python3.12"
]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")Project availability:
- Python package
- Snap
- Nix flake
- VSCode extension
Features:
- Diagnostics
- Autocompletion on typing
- Symbol documentation
Ecosystem:
- Encourage *craft tools to refine their JSONSchemas even further