I've been trying out Love2D by recreating old retro games, I like how simple Love is, and I get to use neovim as my editor of choice. While browsing the Lua LS documentation, I noticed this on the "Add-ons" page.
Addons can be used to add additional content for the Lua Language Server by doing the following:
- Providing definitions for a framework/library/API.
This had bothered me for a while, since using Love's API does not provide any sort of competition.
First, pick a directory to store all your add-ons. Mine will be ~/.local/share/LuaAddons
.
mkdir ~/.local/share/LuaAddons
cd ~/.local/share/LuaAddons
Here we will grab a copy of the Love2D add-on.
git clone https://github.com/LuaCATS/love2d.git
Open your neovim configuration and edit Lua LS's set-up snippet.
lspconfig.lua_ls.setup {
settings = {
Lua = {
workspace = {
-- Path to your Addons directory
userThirdParty = {os.getenv("HOME") .. ".local/share/LuaAddons"},
checkThirdParty = "Apply"
}
}
}
}
This should be everything you need to get a nice competition menu when using love
.
You can check the official documentation for reference.
Top comments (0)