Skip to main content

Autocomplete

GLuaLS suggests GMod API functions, local variables, class members, hook names, net message names, and other symbols based on your cursor position. Triggers as you type. Press Ctrl+Space to trigger it yourself.

Call snippets

When you complete a function call, GLuaLS inserts a snippet with tab stops for each parameter:
hook.Add("PlayerSpawn", "MyAddon", function(|ply|) -- cursor placed on first param
    -- ...
end)
Disable call snippets if you prefer plain completions:
Use the settings menu instead of editing the JSON file directly. This helps you avoid config mistakes.
.gluarc.json
{
  "completion": {
    "callSnippet": false
  }
}

Staged snippets

For GMod functions with complex signatures (hook.Add, net.Receive, timer.Create, etc.), GLuaLS generates a snippet with the expected callback body:
-- Typing net.Receive and accepting the staged snippet generates:
net.Receive("MessageName", function(len, ply)
    local value = net.ReadString()
end)

Postfix completions

Type a postfix trigger after an expression to insert a completion template:
-- Type: ply@ then select "IsValid"
if IsValid(ply) then
    -- ...
end
The default postfix trigger is @. Change it in .gluarc.json with completion.postfix.

Auto-require

When you complete an identifier from another module, GLuaLS can insert a require() at the top of the file:
Use the settings menu instead of editing the JSON file directly. This helps you avoid config mistakes.
.gluarc.json
{
  "completion": {
    "autoRequire": true,
    "autoRequireFunction": "require",
    "autoRequireSeparator": "."
  }
}

Hover documentation

Hover over any GMod API function, variable, or annotated symbol to see its documentation:
  • Function signature with parameter names and types
  • Return type
  • Description (from wiki or --- comment)
  • Realm badge: Client / Server / Shared indicator
  • Deprecation notice if applicable

Signature help

As you type function arguments, GLuaLS shows the parameter signature above the cursor, highlighting the current parameter:
ents.Create(|classname|)
--          ^^^^^^^^^^^^ currently filling this parameter

Go to definition

Press F12 or right-click → Go to Definition to jump to where a function or variable is defined. Works for:
  • GMod API functions, which open the annotations file
  • Your own functions and classes
  • require()d modules
Go to references (Shift+F12) finds every use of a symbol across your workspace.

Symbol renaming

Press F2 to rename a variable, function, or field. GLuaLS applies the rename across all files in your workspace, including string-based accesses when references.fuzzySearch is enabled.

Document outline

The outline view (Ctrl+Shift+O) shows the structure of the current file. With GMod analysis enabled, outline verbosity is controlled by gmod.outline.verbosity:
LevelWhat is shown
minimalFunctions, classes, VGUI panels, hooks, net receivers, timers, concommands only
normal (default)Same as minimal, plus non-primitive variables and typed tables
verboseAll locals, assignments, and control-flow blocks

Semantic highlighting

GLuaLS provides semantic token coloring that extends your theme’s base Lua syntax highlighting with additional information:
  • Parameters are colored differently from locals
  • Class members are highlighted based on their owning class
  • Deprecated symbols appear with a strikethrough
  • Globals are distinguishable from locals
Enable or disable with semanticTokens.enable in .gluarc.json.

Code lens

Code lens annotations appear above functions and class definitions:
  • References count: how many places call this function
  • VGUI panel indicator: links to the panel definition for VGUI components
Configure with codeLens.enable and gmod.vgui.codeLensEnabled in .gluarc.json.

VSCode integration

Code intelligence features work in VS Code after the extension starts. Use the settings panel or .gluarc.json to configure autocomplete, hover documentation, and go-to-definition. See Completion settings and Hints & Hover settings for the full reference.