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.
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
Other Lua extensions
GLuaLS uses its ownglua 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.
-
.luafiles open as GLua by default. To keep a file on standard Lua, such as a build script, add it tofiles.associations:VS Code settings -
Put editor settings for GMod files under
[glua], not[lua]. -
Disable GLua Enhanced. It handles the same
gluafiles, 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
Theglua_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:
gluals-annotations branch and pass its folder to the server:
gmod.annotationsPath in .gluarc.json. It takes priority over the command-line flag.