Skip to content

Batalex/craft-ls

Repository files navigation

craft-ls

GitHub Actions Workflow Status

Get on
PyPI - Version FlakeHub Snap - Version VSCode Marketplace

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.

Features

Feature Snapcraft Rockcraft Charmcraft1
Diagnostics
Documentation on hover
Symbols
Autocompletion
demo.mov

Usage

Installation

Using uv or pipx

uv tool install craft-ls

pipx install craft-ls

Setup

Helix

# languages.toml
[[language]]
name = "yaml"
language-servers = ["craft-ls"]

[language-server.craft-ls]
command = "craft-ls"

VSCode

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"
]

Neovim

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")

Roadmap

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

Footnotes

  1. snapcraft, rockcraft and partial support for charmcraft (all-in-one charmcraft.yaml only) 2

About

craft-ls enables editors that support the LSP to get quality of life improvements while working on *craft configuration files.

Resources

Contributing

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages