Skip to main content

Install the extension

1

Install from the marketplace

Search for Garry’s Mod Language Server in the VS Code Extensions panel (Ctrl+Shift+X), or install it from the Visual Studio Marketplace or Open VSX.
2

Open your addon or gamemode

Open the addon or gamemode folder itself, not the whole garrysmod/ folder. See Open your project if you work on several at once.
3

Wait for the first download

On first launch the extension downloads the language server and the Garry’s Mod annotations. The GLuaLS item in the status bar shows when the server is running.
The extension keeps the server and annotations up to date for you.

Check that it works

Open any .lua file in your project. You should see:
  • Suggestions as you type, with documentation for each function
  • Documentation when you hover a function, including the realm it runs in
  • Squiggly underlines on likely mistakes
If nothing happens, check the language mode in the bottom right of VS Code. It should say GLua. If it says Lua, click it and choose GLua.

Other Lua extensions

GLuaLS uses its own glua language mode, so a standard Lua extension can stay installed for non-GMod projects. It handles files set to lua and GLuaLS handles files set to glua.
  • .lua files open as GLua by default. To keep a file on standard Lua, such as a build script, add it to files.associations:
    VS Code settings
  • Put editor settings for GMod files under [glua], not [lua].
  • Disable GLua Enhanced. It handles the same glua files, and GLuaLS will not start while it is enabled.

Status bar menu

Click GLuaLS in the status bar for quick actions:
  • Restart or stop the server
  • Open the settings panel
  • Set up the debugger
  • Show the server output, which helps when reporting a bug

Other editors

The glua_ls server works in any editor that supports the Language Server Protocol. The settings panel, debugger and automatic downloads need the VS Code extension. Download glua_ls from the GitHub releases or install it with Cargo:
Outside VS Code you need to provide the Garry’s Mod annotations yourself. Download the gluals-annotations branch and pass its folder to the server:
You can also set gmod.annotationsPath in .gluarc.json. It takes priority over the command-line flag.