Skip to content

takeshiD/typua

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Typua

typua is a lua typechecker for Lua5.1, 5.2, 5.3, 5.4, LuaJIT.

typua type-annotation syntax is compatibled lua-language-server.

Features

  • 🚀 Blazing Fast Typecheck
  • 💾 Low memory usage
  • 🖥️ Language Server Support

Install

npm(⚠ Planned)

npm install -g @takeshid/typua

uv(⚠ Planned)

uv tool install typua

nix(⚠ Planned)

nix-env --install typua

cargo

cargo install typua

Editor Integration

nvim

builtin-lsp

vim.lsp.enable("typua")
vim.lsp.config("typua", {
	cmd = { "typua", "lsp" },
	filetypes = { "lua" },
})

lspconfig(⚠ Planned)

require("lspconfig").typua.setup({
	cmd = { "typua", "lsp" },
	filetypes = { "lua" },
}

Using with lua-ls

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",
                }
            }
		},
	},
}

Using typua in CI/CD(⚠ Planned)

not yet setup

Using typua as pre-commit hook(⚠ Planned)

not yet setup

Configure

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

About

a lua typechecker and language server

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published