๐ป lua-dev
Dev setup for init.lua and plugin development with full signature help, docs and completion for the nvim lua API.
โจ Features
- EmmyLua library for the nvim lua API for:
- completion
- hover docs
- function signatures
- properly configures the
require
path withlua/?.lua
andlua/?/init.lua
. - adds all plugins in
opt
andstart
to the workspace so you get completion for all installed plugins - properly configure the vim runtime
โก๏ธ Requirements
- Neovim >= 0.5.0
- completion plugin like nvim-compe or completion-nvim
๐ฆ Installation
Install the plugin with your preferred package manager:
packer
use "folke/lua-dev.nvim"
vim-plug
Plug 'folke/lua-dev.nvim'
โ๏ธ Configuration
lua-dev comes with the following defaults:
{
library = {
vimruntime = true, -- runtime path
vimconfig = true, -- typically ~/.config/nvim
plugins = true, -- installed opt or start plugins in packpath
types = true, -- full signature, docs and completion of vim.api, vim.treesitter, vim.lsp and others
},
}
๐ Setup
local luadev = require("lua-dev").setup({
-- add any options here, or leave empty to use the default settings
})
local lspconfig = require('lspconfig')
lspconfig.sumneko_lua.setup(luadev)
โ How?
Neovim includes a script to generated the nvim docs. That script also creates message pack files containing all the API metadata in a structured way. Unfortunately these files are not packaged in the releases.
Using the message pack files, I converted all the API data to EmmyLua annotations and make them available for the Sumneko LSP as a workspace library.
๐๏ธ Limitations
vim.fn
functions are currently not part of the EmmyLua library since no message pack files are generated.- function return types are always
any
, since that information is missing