Wezterm config types for Lua Language Server
Example in Neovim:
wezterm_types.mp4
You can find the current roadmap here
For Neovim users, we recommend the following install method.
Using lazy.nvim
as a package manager, install this together with
lazydev
:
require('lazy').setup({
spec = {
{
'folke/lazydev.nvim',
ft = 'lua',
dependencies = {
{ 'DrKJeff16/wezterm-types', lazy = true },
},
opts = {
library = {
-- Other library configs...
{ path = 'wezterm-types', mods = { 'wezterm' } },
},
},
},
},
})
NOTE: If you assign a custom `name` field for the plugin
{
{
'folke/lazydev.nvim',
ft = 'lua',
dependencies = {
{
'DrKJeff16/wezterm-types',
name = '<my_custom_name>', -- CUSTOM DIRECTORY NAME
lazy = true,
},
},
opts = {
library = {
-- Other library configs...
-- MAKE SURE TO MATCH THE PLUGIN DIRECTORY'S NAME
{ path = '<my_custom_name>', mods = { 'wezterm' } },
},
},
},
}
After installing the types, add the type annotations to wezterm
and config
respectively
when requiring wezterm in your configuration:
---@type Wezterm
local wezterm = require("wezterm")
---@type Config
local config = wezterm.config_builder()
-- Your configuration here with full type support
config.window_decorations = "RESIZE|MACOS_FORCE_DISABLE_SHADOW"
return config
These annotations enable the Lua Language Server to provide proper type checking and autocompletion for WezTerm configuration options.
- @DrKJeff16 - Maintainer, (current owner)
- @justinsgithub - The Author (not active currently)
- @gonstoll - Maintainer
- @TheLeoP - Contributor
The project is structured the following way:
/lua/wezterm/types/
├── config.lua <== Contains the `Config` class and related data types
├── enum.lua <== Imports all the `enum/` files
├── enum/ <== Enum types
│ ├── copy-mode-assignment.lua <== `CopyModeAssignment` enum types
│ └── key-assignment.lua <== `KeyAssignment` enum types
├── events.lua <== Imports all the `events/` files
├── events/ <== Events type files
│ ├── gui.lua <== `Gui` event types
│ ├── multiplexer.lua <== `Mux` event types
│ └── window.lua <== `Window` event types
├── objects.lua <== Imports all the `objects/` files
├── objects/ <== Objects type files
│ ├── color.lua <== `Color` object types
│ ├── exec-domain.lua <== `ExecDomain` object types
│ ├── local-process-info.lua <== `LocalProcessInfo` object types
│ ├── mux-domain.lua <== `MuxDomain` object types
│ ├── mux-tab.lua <== `MuxTab` object types
│ ├── mux-window.lua <== `MuxWindow` object types
│ ├── pane-information.lua <== `PaneInformation` object types
│ ├── pane.lua <== `Pane` object types
│ ├── spawn-command.lua <== `SpawnCommand` object types
│ ├── ssh-domain.lua <== `SshDomain` object types
│ ├── tab-information.lua <== `TabInformation` object types
│ ├── time.lua <== `Time` object types
│ ├── tls-domain-client.lua <== `TlsDomainClient` object types
│ ├── tls-domain-server.lua <== `TlsDomainServer` object types
│ ├── window.lua <== `Window` object types
│ └── wsl-domain.lua <== `WslDomain` object types
├── wezterm.lua <== Imports all the surrounding files, including the `wezterm/` directory
├── wezterm/ <== Types for the `wezterm` module
│ ├── color.lua <== `Wezterm.Color` module types
│ ├── gui.lua <== `Wezterm.Gui` module types
│ ├── mux.lua <== `Wezterm.Mux` module types
│ ├── nerdfonts.lua <== `Wezterm.NerdFonts` module types
│ ├── plugin.lua <== `Wezterm.Plugin` module types
│ ├── procinfo.lua <== `Wezterm.ProcInfo` module types
│ ├── serde.lua <== `Wezterm.Serde` module types
│ ├── time.lua <== `Wezterm.Time` module types
└───└── url.lua <== `Wezterm.Url` module types