Skip to main content

Single addon or gamemode

Open the addon or gamemode folder directly in VS Code. The extension detects the structure from its path (garrysmod/addons/ or garrysmod/gamemodes/).
garrysmod
addons
my-addon <- Workspace Root
lua
addon.json
.gluarc.json
...
gamemodes
my-gamemode <- Workspace Root
gamemode
.gluarc.json
gamemode.txt
...

Multi-root workspaces

If you work on a gamemode and multiple addons, use a multi-root workspace and add each as its own folder. By default, GLuaLS disables multi-root workspace isolation. The language server merges workspace configs into one global baseline. The first workspace config wins scalar conflicts, arrays are unioned, and per-workspace file overrides still apply where needed. You can enable isolation with workspace.enableIsolation when you want each folder analyzed separately. See Configuration for details.
Do not open the entire garrysmod/ folder as your workspace root. GLuaLS expects each root to be an individual addon or gamemode, not the entire game directory.

Library paths

If your project uses shared utility files outside the workspace root, add them as library paths:
Use the settings menu instead of editing the JSON file directly. This helps you avoid config mistakes.
.gluarc.json
{
  "workspace": {
    "library": [
      "/path/to/shared-utils",
      {
        "path": "./external/mylibrary",
        "ignoreDir": ["tests"],
        "ignoreGlobs": ["**/*.spec.lua"]
      }
    ]
  }
}
GLuaLS analyzes library files and makes their types available in your workspace. It does not report diagnostics for library files.

Ignoring files and folders

Use the settings menu instead of editing the JSON file directly. This helps you avoid config mistakes.
.gluarc.json
{
  "workspace": {
    "ignoreDir": ["build", "dist", ".git"],
    "ignoreGlobs": ["**/*.min.lua", "tests/**"]
  }
}

Custom require patterns

If your project uses a custom module loader, map it to require behavior:
Use the settings menu instead of editing the JSON file directly. This helps you avoid config mistakes.
.gluarc.json
{
  "runtime": {
    "requireLikeFunction": ["include", "MYADDON.Require"],
    "requirePattern": ["?.lua", "?/init.lua"]
  }
}

Annotations path

By default, the VS Code extension downloads and updates GMod wiki annotations. If you need a custom annotations build or want to turn off downloads:
Use the settings menu instead of editing the JSON file directly. This helps you avoid config mistakes.
.gluarc.json
{
  "gmod": {
    "annotationsPath": "./my-custom-annotations",
    "autoLoadAnnotations": false
  }
}
See Annotations management for details on annotation downloads.

Next steps

Set up the debugger

Move from workspace setup to runtime debugging on SRCDS.

Debugger overview

See what breakpoints, stepping, inspection, and Lua execution can do.

Configuration overview

Tune GLuaLS behavior for your workspace.

Features overview

Browse the main language, debugger, and GMod-specific features.