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:
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

Staged snippets

For GMod functions with complex signatures (hook.Add, net.Receive, timer.Create, etc.), GLuaLS generates a snippet with the expected callback body:

Postfix completions

Type a postfix trigger after an expression to insert a completion template:
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

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:

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
Find All References (Shift+F12) finds every use of a symbol across your workspace.

Symbol renaming

Press F2 to rename a variable, function, or field across your workspace. Set references.shortStringSearch to true if your project also stores symbol names in short strings.

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:

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:
  • Reference count: how many places use this symbol
  • VGUI panel indicator: links to the panel definition for VGUI components
  • Network message count: links to known senders and receivers
Configure with codeLens.enable and gmod.vgui.codeLensEnabled in .gluarc.json.

VS Code 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.