Logo

dev-resources.site

for different kinds of informations.

How to configure neovim's Lua LS for Love2D

Published at
12/24/2024
Categories
love2d
lua
nvim
Author
je12emy
Categories
3 categories in total
love2d
open
lua
open
nvim
open
Author
7 person written this
je12emy
open
How to configure neovim's Lua LS for Love2D

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
Enter fullscreen mode Exit fullscreen mode

Here we will grab a copy of the Love2D add-on.

git clone https://github.com/LuaCATS/love2d.git
Enter fullscreen mode Exit fullscreen mode

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"
            }
        }
    }
}
Enter fullscreen mode Exit fullscreen mode

This should be everything you need to get a nice competition menu when using love.

Editor screenshot

You can check the official documentation for reference.

lua Article's
30 articles in total
Favicon
Polyglot: Lua (Part 1)
Favicon
Polyglot: Lua (Part 0)
Favicon
Rust-like Iteration in Lua
Favicon
Lua as your favorite Programming Language
Favicon
How to configure neovim's Lua LS for Love2D
Favicon
4G module update for the power failure alarm device with call telephone function
Favicon
Managing LSPs in Neovim: Enable/Disable for the Entire Session
Favicon
Austria RP Roblox
Favicon
FiveM RAT Analysis
Favicon
So... I created yet another Neovim plugin
Favicon
When (not) to write an Apache APISIX plugin
Favicon
Using xLua in Unity
Favicon
Doing Horrible Things in Haskell
Favicon
Supercharge Your Neovim Workflow with project-cli-commands.nvim
Favicon
Extensible Control of Reaper via OSC and Scripts
Favicon
Buscadores personalizados con Mini.Pick
Favicon
Kong Plugin Development: Local Development and Installation on Your Laptop/VM
Favicon
Running Lua C modules in a pure Lua environment (1)
Favicon
5 Lesser-Known Programming Languages That Are Easy to Learn and Highly Effective
Favicon
pico 8 game missing flag game by nassim hadadd
Favicon
How to Code with Lua on ESP32 with XEdge32
Favicon
Five ways to pass parameters to Apache APISIX
Favicon
libcert: Implementing S/MIME PKI in Lua (2)
Favicon
libcert: Implementing S/MIME PKI in Lua (1)
Favicon
Kong plugin development with breakpoint debugging
Favicon
Implementing the Idempotency-Key specification on Apache APISIX
Favicon
Complete and Quick Guide to Lua 🌑
Favicon
Understanding If Statements in Lua
Favicon
Understanding Loops in Lua
Favicon
Understanding Lua's lfs Module

Featured ones: