Skip to content

Zaenalos/tree-sitter-lua

Repository files navigation

tree-sitter-lua

CI

A Tree-sitter grammar for Lua 5.5.

Built primarily to power a Zed extension, but compatible with any editor or tool that supports Tree-sitter — including VS Code (via nvim-treesitter or similar), Neovim, Emacs, and others.

You might want to check the Zed extension I'm working on: https://github.com/Zaenalos/Lua-Zed

Features

  • Full Lua 5.1 - 5.5 syntax support including global declarations, attributes (<const>, <close>), and global *
  • Complete syntax highlighting, check highlights.scm

Usage

CLI

npm install -g tree-sitter-cli
# or you might want to use bun
bun add -g tree-sitter-cli # requires node v22.22.1
tree-sitter parse your_file.lua
tree-sitter highlight your_file.lua

# testing
tree-sitter test
tree-sitter parse test-lua/*.lua

Tests

Suite Status
Corpus (literals, expressions, statements, functions, comments) ✅ 55/55 passing
Sample file parsing (test-lua/*.lua) ✅ No errors or missing nodes

Contributing

Found a bug or missing feature? Feel free to open an issue or submit a pull request.

References

License

MIT


Credits to Lua for the test files :)

Packages

 
 
 

Contributors

Languages