Skip to content

stefanvanburen/cells

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cells

A language server for CEL (Common Expression Language). It operates on individual .cel files, providing various LSP features.

Installation

$ go install github.com/stefanvanburen/cells/cmd/cells@latest

Features

  • Semantic highlighting
  • Diagnostics
  • Formatting
  • Hover
  • References
  • Completion
  • Signature help
  • Variable renaming
  • Inlay hints (expression evaluation)

CLI

In addition to operating as a language server, cells provides CLI commands for use outside an editor.

cells format

Format CEL source files. With no arguments, reads from stdin and writes to stdout.

$ echo "1+2" | cells format
1 + 2
$ cells format file.cel
$ cells format --write file.cel
$ cells format --diff file.cel
$ cells format --diff --write file.cel

cells check

Check CEL source files for parse and type errors. Prints file:line:col: error: message for each diagnostic and exits 1 if any are found.

$ cells check file.cel
$ cells check *.cel

cells hover

Show documentation for the element at a given position (file:line:col, 1-indexed).

$ cells hover file.cel:1:7

cells references

List all references to the identifier at a given position. Each reference is printed as file:line:col.

$ cells references file.cel:1:1

cells rename

Rename the identifier at a given position. Without --write, prints the updated content to stdout.

$ cells rename --new-name=newVar file.cel:1:1
$ cells rename --new-name=newVar --write file.cel:1:1

Usage

Neovim

Add to your config (e.g. ~/.config/nvim/init.lua):

vim.lsp.config("cells", {
  filetypes = { "cel" },
  cmd = { "cells", "serve" },
})
vim.lsp.enable("cells")

Neovim doesn't recognize .cel files by default (until 0.12 is released), so you'll also need to add a filetype detection rule:

vim.filetype.add({
  extension = {
    cel = "cel",
  },
})

To verify it's working, open a .cel file and run :checkhealth lsp or :LspInfo.

About

A Language Server for CEL

Topics

Resources

Stars

Watchers

Forks

Contributors