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

# Completion Settings

> Configure autocomplete behavior, call snippets, postfix triggers, and auto-require.

## Overview

The `completion` section controls autocomplete suggestions. These options adjust snippet expansion, require insertion, and the postfix trigger character.

***

## Options

| Option                                   | Type      | Default     | Description                                                                                                                            |
| ---------------------------------------- | --------- | ----------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| `completion.enable`                      | `boolean` | `true`      | Enable autocomplete entirely                                                                                                           |
| `completion.callSnippet`                 | `boolean` | `true`      | Insert function calls as snippets with parameter placeholders                                                                          |
| `completion.stagedCallSnippets`          | `boolean` | `true`      | Use staged snippets for known GMod APIs (`hook.Add`, `net.Receive`, `net.Start`, etc.)                                                 |
| `completion.postfix`                     | `string`  | `"@"`       | Trigger character for postfix completions. Options: `"@"`, `"."`, `":"`                                                                |
| `completion.autoRequire`                 | `boolean` | `true`      | Insert a `require()` statement when completing a symbol from another module                                                            |
| `completion.autoRequireFunction`         | `string`  | `"require"` | Function name used when auto-inserting a require                                                                                       |
| `completion.autoRequireNamingConvention` | `string`  | `"keep"`    | Convention for the local alias when auto-requiring. Options: `"keep"`, `"snake-case"`, `"pascal-case"`, `"camel-case"`, `"keep-class"` |
| `completion.autoRequireSeparator`        | `string`  | `"."`       | Separator used in the auto-generated require path                                                                                      |
| `completion.baseFunctionIncludesName`    | `boolean` | `true`      | Include the function name in completions for base class functions                                                                      |

***

## Call snippets

When `callSnippet` is enabled, selecting a function in autocomplete inserts it with parameter placeholders:

```lua theme={null}
-- Typing: hook.Add(
-- Inserts:
hook.Add("${1:HookName}", "${2:Identifier}", function(${3})
    ${4}
end)
```

### Staged snippets

`stagedCallSnippets` enables split-stage completion for known GMod callbacks. After you accept a hook name, GLuaLS uses the expected hook signature and fills parameter names. Set `false` to use a generic placeholder.

***

## Postfix completions

Postfix completions let you write a value and then trigger a structural completion after it:

```lua theme={null}
tab@           -- triggers postfix menu on `tab`
-- Postfix options: pairs, ipairs, #, etc.
```

Change the trigger character if `@` conflicts with your code style.

***

## Auto-require

When you accept a completion from an imported module, `autoRequire` inserts a `require()` at the top of the file:

```lua theme={null}
-- Accepting `mylib.doThing` inserts:
local mylib = require("mylib")
```

Set `autoRequireFunction` to your project's custom loader if you use one:

```json .gluarc.json theme={null}
{
  "completion": {
    "autoRequireFunction": "include"
  }
}
```

***

## VS Code extension settings

You can also configure these settings in VS Code settings with the `gluals.*` prefix:

| VS Code setting                              | .gluarc.json key                      | Type      | Default | Description                    |
| -------------------------------------------- | ------------------------------------- | --------- | ------- | ------------------------------ |
| `gluals.completion.enable`                   | `completion.enable`                   | `boolean` | `true`  | Enable autocompletion          |
| `gluals.completion.callSnippet`              | `completion.callSnippet`              | `boolean` | `true`  | Show call snippets             |
| `gluals.completion.stagedCallSnippets`       | `completion.stagedCallSnippets`       | `boolean` | `true`  | Stage API call snippets        |
| `gluals.completion.postfix`                  | `completion.postfix`                  | `string`  | `"@"`   | Postfix trigger character      |
| `gluals.completion.autoRequire`              | `completion.autoRequire`              | `boolean` | `true`  | Auto-insert require statements |
| `gluals.completion.baseFunctionIncludesName` | `completion.baseFunctionIncludesName` | `boolean` | `true`  | Include name in base function  |

***

## Example

```json .gluarc.json theme={null}
{
  "completion": {
    "enable": true,
    "callSnippet": true,
    "stagedCallSnippets": true,
    "postfix": "@",
    "autoRequire": false
  }
}
```
