typua
is a lua typechecker for Lua5.1, 5.2, 5.3, 5.4, LuaJIT.
typua
type-annotation syntax is compatibled lua-language-server.
- 🚀 Blazing Fast Typecheck
- 💾 Low memory usage
- 🖥️ Language Server Support
npm install -g @takeshid/typua
uv tool install typua
nix-env --install typua
cargo install typua
vim.lsp.enable("typua")
vim.lsp.config("typua", {
cmd = { "typua", "lsp" },
filetypes = { "lua" },
})
require("lspconfig").typua.setup({
cmd = { "typua", "lsp" },
filetypes = { "lua" },
}
typua
can be used in combination with lua-ls
for example nvim-lspconfig, disable lua-ls
type-check, but leave the other diagnostics enabled.
return {
cmd = { "lua-language-server" },
filetypes = { "lua" },
settings = {
Lua = {
diagnostics = { -- use with typua
enable = true,
disable = { -- disable typecheck
"assign-type-mismatch",
"param-type-mismatch",
"return-type-mismatch",
"undefined-field",
}
}
},
},
}
not yet setup
not yet setup
typua
detects .typua.toml
in workingspace root.
on the other hand, use --config/-c
option like typua --config your_typua.toml
.
[runtime]
version = "luajit" # default luajit, other version lua51, lua52, lua53, lua54
include = [
"~/.luarocks/share/lua/5.3/*.lua",
"$HOME/.luarocks/share/lua/5.3/*.lua",
"/usr/share/5.3/*.lua",
"/usr/share/lua/5.3/*/init.lua",
]