Tree-sitter grammar for LiteJS UI templates (.ui files).
Add to ~/.config/helix/languages.toml:
[[language]]
name = "litejs"
scope = "source.litejs"
file-types = ["ui"]
comment-token = "/"
indent = { tab-width = 4, unit = "\t" }
[[grammar]]
name = "litejs"
source = { git = "https://github.com/litejs/tree-sitter-litejs", rev = "main" }Build and install queries:
hx --grammar fetch && hx --grammar build
mkdir -p ~/.config/helix/runtime/queries/litejs
cp queries/*.scm ~/.config/helix/runtime/queries/litejs/ln -s /path/to/tree-sitter-litejs/editors/vscode ~/.vscode/extensions/litejsRestart VS Code after installing.
Install as a dev extension from the repository root.
To build the grammar locally:
mkdir -p grammars/litejs
cd grammars/litejs
git clone https://github.com/litejs/tree-sitter-litejs .
npx tree-sitter generate
npx tree-sitter build --wasm -o ../../litejs.wasmAdd to init.lua (requires nvim-treesitter):
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
parser_config.litejs = {
install_info = {
url = "https://github.com/litejs/tree-sitter-litejs",
files = { "src/parser.c", "src/scanner.c" },
branch = "main",
},
filetype = "litejs",
}
vim.filetype.add({ extension = { ui = "litejs" } })Then :TSInstall litejs and link queries:
ln -s /path/to/tree-sitter-litejs/queries ~/.config/nvim/queries/litejsnpm install
npx tree-sitter generate
npx tree-sitter parse test/main.uiMIT