> ## Documentation Index
> Fetch the complete documentation index at: https://gluals.arnux.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Code intelligence

> Completions, hover documentation, signature help, semantic highlighting, and more.

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

```lua theme={null}
hook.Add("PlayerSpawn", "MyAddon", function(|ply|) -- cursor placed on first param
    -- ...
end)
```

Disable call snippets if you prefer plain completions:

<Tip>
  Use the settings menu instead of editing the JSON file directly. This helps you avoid config mistakes.
</Tip>

```json .gluarc.json theme={null}
{
  "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:

```lua theme={null}
-- 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:

```lua theme={null}
-- 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:

<Tip>
  Use the settings menu instead of editing the JSON file directly. This helps you avoid config mistakes.
</Tip>

```json .gluarc.json theme={null}
{
  "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:

```lua theme={null}
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

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

| Level              | What is shown                                                                   |
| ------------------ | ------------------------------------------------------------------------------- |
| `minimal`          | Functions, classes, VGUI panels, hooks, net receivers, timers, concommands only |
| `normal` (default) | Same as minimal, plus non-primitive variables and typed tables                  |
| `verbose`          | All 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:

* **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](/configuration/overview#settings-panel-recommended) or `.gluarc.json` to configure autocomplete, hover documentation, and go-to-definition. See [Completion settings](/configuration/completion) and [Hints & Hover settings](/configuration/hints-and-hover) for the full reference.
