A fully configured VSCode template for LOVE
- 📄 Rich Lua language features with Lua Language Server
- 🔧 Debugging with Local Lua Debugger
- 🏢 Automatic builds with Makelove
- 👨💻 Consistent coding styles with Editorconfig
- 🏃♂️ Running scripts with NPM Scripts
- 🗂️ Organized with Workspaces
- 🔗 Extensible and configurable for your needs
- Visual Studio Code
- LÖVE 11.4
- Makelove
- NPM (Optional)
LÖVE and Makelove should be in your PATH environment variable.
1 - Use this template to create a new repository for your game, then clone that repository locally.
2 - Open the Workspace.code-workspace
file with Visual Studio Code.
You will be prompted that there are recommended extensions and if you want to install these. Click 'Install'.
If this does not happen, install Sumneko's Lua extension, Local Lua Debugger and Editorconfig manually.
3 - Configure the Game/conf.lua
and Tools/build/makelove.toml
with the settings specific for your game.
NOTE: Make sure to keep t.console
set to false
in love.confg
. Local Lua Debugger will not work otherwise.
4 - Configure the Root/.editorconfig
to your liking for code styles.
5 - Change the Root/LICENSE
file to your liking and/or swap out my name for your name.
In case you need help, feel free to send me (Keyslam) a message in the LÖVE Discord server. There's also a bunch of other cool people there who are always willing to help.
Press F5
to launch the game in 'Debug mode'. In debug mode you can use breakpoints and inspect variables. This does have some performance impact though.
You can switch to 'Release mode' in the 'Run and Debug' tab (Ctrl+Shift+D
).
Alternatively, you can run lovec game
in the terminal, but you will have debugging capabilities.
├── /Game
│ ├── /assets Contains the game's assets
│ ├── /lib Contains external libraries
│ └── /src Contains the game's source code
│
├── Tools
│ ├── /build Contains the makelove.toml
│ └── package.json Contains all scripts to use with NPM Scripts
│
├── Resources Contains resources for you game that should not be shipped, like raw audio
│
├── Builds Contains the builds of your game made with makelove
│
└── Root Root access to the workspace
Pixelbyte Studio's "Love2D support" extension is commonly used by beginners because it is the first result that shows up when you search for LÖVE extensions in VSCode. However, it doesn't add any features you can't get with a well configured VSCode workspace. It also doesn't work with Local Lua Debugger and gives conflicting Intellisense results with the Lua Language Server.
Sometimes you don't want a full blown template and just get the minimum required settings to get your editor working. The following steps will explain how to setup a project with the Sumneko Language Server and a launch task:
-
Create a folder for your game with your
main.lua
andconf.lua
. -
Open the folder with VSCode.
-
Install the Sumneko Lua Language Server and Local Lua Debugger extensions.
-
In the same folder as your
main.lua
, create a folder named.vscode
-
In the
.vscode
folder, create a file namedsettings.json
and copy the following contents into it:
{
"Lua.workspace.library": [
"${3rd}/love2d/library",
"lib"
],
"Lua.runtime.version": "LuaJIT",
"Lua.workspace.checkThirdParty": false,
}
- In the
.vscode
folder, create a file namedlaunch.json
and copy the following contents into it:
{
"version": "0.2.0",
"configurations": [
{
"type": "lua-local",
"request": "launch",
"name": "Release",
"program": {
"command": "love"
},
"args": [
".",
],
},
]
}
You can use this template as a basis for how to add additional features such as debugging, code styles, folder structures, automatic builds, et cetera.