Skip to main content

One addon or gamemode

Open the addon or gamemode folder directly in VS Code:
garrysmod
addons
my-addon ← open this
lua
addon.json
gamemodes
my-gamemode ← or this
gamemode
my-gamemode.txt
The folder does not have to be inside a Garry’s Mod install. A standalone Git repository of an addon works the same way.
Do not open the whole garrysmod/ folder. It contains game files and unrelated addons, which makes analysis slower and adds warnings from code that is not yours.

Several addons or a gamemode with addons

Use a multi-root workspace and add each addon or gamemode as its own folder (File → Add Folder to Workspace). GLuaLS analyzes all folders together, so code in one folder can use functions and classes from another.

Gamemodes based on another gamemode

If your gamemode’s .txt file sets a base, GLuaLS loads that base gamemode automatically when it can find it next to yours. For example, a Helix schema finds the helix gamemode in the same gamemodes/ folder. base and sandbox are always available. If the base gamemode lives somewhere else, add it as a library (see below).

Code from outside your project

If your code uses an addon or library that is not open in VS Code, add its folder to workspace.library in .gluarc.json. GLuaLS reads its functions and types, but does not show warnings for it.
.gluarc.json
Relative paths start from your project folder.

Skip files

GLuaLS already skips folders such as .git, node_modules and the folders GLuaTest loads tests from (lua/tests and gamemode/tests). To skip more, right-click a folder in the Explorer and choose Add Directory to Ignore List, or edit .gluarc.json:
.gluarc.json
See Workspace settings for every option.