Introduction
In the world of Neovim plugin development. One of superpowers enabled by the Lua language
in Neovim is type annotations using EmmyLua-style comments (---@).
These annotations supercharge documentation, IDE integration, and code readability.
In lazydocker.nvim, a plugin that embeds LazyDocker
into a Neovim floating window, I extensively used these annotations.
Lua Type Annotations
Lua is dynamically typed, but Neovim’s LSP (via nvim-lspconfig and emmy-lua) supports EmmyLua annotations:
---@class MyClass
---@field field string A description.
---@param param string Input param.
---@return boolean Success?
function myFunc(param) end
These generate: