batteries-lsp-annotations

April 11, 2026 · View on GitHub

Lua LSP annotations for batteries.

Probably not complete but good enough for my use.

Doesn't cover the :camelCased versions of the function names, not sure how to go about doing that cleanly.

PRs welcome!

How to use

Put it somewhere the LSP recognises definitions files.

tldr for template users

If you're using keyslam's VSCode template then

  • add an lsp-definitions folder in the root
  • clone/submodule/copypaste/whatever this repo into that folder
  • edit the .vscode/settings.json to tell the lsp where your definitions live:
{
	"Lua.workspace.library": [
		"${3rd}/love2d/library",
		"${workspaceFolder:Root}/lsp-definitions/"
	],
	"Lua.runtime.version": "LuaJIT",
	"Lua.workspace.checkThirdParty": false,
}
  • thats it

assuming your file structure looks something like this:

.
├── builds/
├── resources/
├── src/
├── tools/
├── lsp-definitions/
│   └── batteries/ # put this repo here
│       ├── batteries.d.lua
│       └── README.md
├── README.md
└── Workspace.code-workspace

...and you still have a Root workspace folder name in your .code-workspace then you should be getting autocomplete.