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

# Runtime and strict settings

> Configure non-standard Lua symbols, strict type checking, special functions, and documentation format.

## Overview

The `runtime`, `strict`, `doc`, and `references` sections control how the language server interprets Lua syntax and checks types.

***

## Runtime (`runtime.*`)

| Option                        | Type       | Default   | Description                                                                  |
| ----------------------------- | ---------- | --------- | ---------------------------------------------------------------------------- |
| `runtime.extensions`          | `string[]` | `[]`      | Additional file extensions to treat as Lua (e.g., `".lua.txt"`)              |
| `runtime.requireLikeFunction` | `string[]` | `[]`      | Functions that behave like `require` for module resolution                   |
| `runtime.requirePattern`      | `string[]` | `[]`      | Require path resolution patterns (e.g., `"?.lua"`, `"?/init.lua"`)           |
| `runtime.version`             | `string`   | `LuaJIT`  | Lua version used for syntax and type behavior. Keep `LuaJIT` for Garry's Mod |
| `runtime.nonstandardSymbol`   | `string[]` | see below | Extra syntax accepted by the parser                                          |
| `runtime.frameworkVersions`   | `string[]` | `[]`      | Framework version identifiers                                                |
| `runtime.special`             | `object`   | `{}`      | Map function names to special behaviours                                     |

### Default non-standard symbols

GLuaLS enables these non-standard symbols by default to match GLua syntax:

```
["//", "/**/", "continue", "!=", "||", "&&", "!"]
```

All available non-standard symbols:

| Symbol                                    | Description                                    |
| ----------------------------------------- | ---------------------------------------------- |
| `//`                                      | Integer division operator                      |
| `/**/`                                    | Block comments (C-style)                       |
| `` ` ``                                   | Backtick strings                               |
| `+=`, `-=`, `*=`, `/=`, `%=`, `^=`, `//=` | Compound assignment operators                  |
| `\|=`, `&=`, `<<=`, `>>=`                 | Bitwise compound assignment                    |
| `\|\|`, `&&`, `!`, `!=`                   | C-style logical operators                      |
| `continue`                                | `continue` statement (not in standard Lua 5.1) |

### Special functions

Tell GLuaLS that a custom function behaves like a built-in Lua function:

```json .gluarc.json theme={null}
{
  "runtime": {
    "special": {
      "include": "require",
      "my_assert": "assert",
      "my_type": "type"
    }
  }
}
```

Available behavior values: `"none"`, `"require"`, `"error"`, `"assert"`, `"type"`, `"setmetatable"`

***

## Strict mode (`strict.*`)

| Option                              | Type      | Default | Description                                                                                          |
| ----------------------------------- | --------- | ------- | ---------------------------------------------------------------------------------------------------- |
| `strict.requirePath`                | `boolean` | `false` | Enforce strict `require()` path validation                                                           |
| `strict.arrayIndex`                 | `boolean` | `false` | Enforce strict array index usage                                                                     |
| `strict.metaOverrideFileDefine`     | `boolean` | `true`  | Allow meta (annotation) file definitions to override file-level definitions                          |
| `strict.docBaseConstMatchBaseType`  | `boolean` | `true`  | Allow base constants (e.g., `0`, `""`) to match their base type                                      |
| `strict.requireExportGlobal`        | `boolean` | `false` | Require explicit `---@export global` annotation for globals to be visible outside their file         |
| `strict.allowNullableAsNonNullable` | `boolean` | `true`  | Allow optional types (`T?`) to be passed where non-optional (`T`) is expected (lenient nil-safety)   |
| `strict.inferredTypeMismatch`       | `boolean` | `false` | Report type mismatch diagnostics for inferred values (stricter checker, may produce false positives) |
| `strict.strictTypeCoercion`         | `boolean` | `false` | Require exact primitive types instead of GLua's common string and number conversions                 |

### Enabling stricter nil checking

```json .gluarc.json theme={null}
{
  "strict": {
    "allowNullableAsNonNullable": false,
    "inferredTypeMismatch": true
  }
}
```

***

## Documentation format (`doc.*`)

| Option                 | Type             | Default | Description                                                            |
| ---------------------- | ---------------- | ------- | ---------------------------------------------------------------------- |
| `doc.syntax`           | `string`         | `"md"`  | Documentation syntax: `"md"`, `"myst"`, `"rst"`, `"none"`              |
| `doc.knownTags`        | `string[]`       | `[]`    | Custom annotation tags to suppress `unknown-doc-tag` warnings for      |
| `doc.privateName`      | `string[]`       | `[]`    | Field name patterns to treat as private (e.g., `["m_*", "_*"]`)        |
| `doc.rstPrimaryDomain` | `string \| null` | `null`  | Main reStructuredText domain when `doc.syntax` is `"rst"` or `"myst"`  |
| `doc.rstDefaultRole`   | `string \| null` | `null`  | Default reStructuredText role when `doc.syntax` is `"rst"` or `"myst"` |

### Custom tag suppression

```json .gluarc.json theme={null}
{
  "doc": {
    "knownTags": ["realm", "hook", "accessorfunc"]
  }
}
```

### Private field naming patterns

```json .gluarc.json theme={null}
{
  "doc": {
    "privateName": ["m_*", "_*", "__*"]
  }
}
```

***

## References (`references.*`)

| Option                         | Type      | Default | Description                                                 |
| ------------------------------ | --------- | ------- | ----------------------------------------------------------- |
| `references.enable`            | `boolean` | `true`  | Enable find references                                      |
| `references.fuzzySearch`       | `boolean` | `true`  | Fall back to fuzzy matching if exact search finds nothing   |
| `references.shortStringSearch` | `boolean` | `false` | Search for variable/function name references inside strings |

***

## Document color (`documentColor.*`)

| Option                 | Type      | Default | Description                                               |
| ---------------------- | --------- | ------- | --------------------------------------------------------- |
| `documentColor.enable` | `boolean` | `true`  | Show color pickers for `Color(r, g, b)` and similar calls |

***

## Resource paths (`resource.*`)

| Option           | Type       | Default | Description                                                          |
| ---------------- | ---------- | ------- | -------------------------------------------------------------------- |
| `resource.paths` | `string[]` | `[]`    | Extra folders used for file path completion and clickable file links |

***

## 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.references.enable`            | `references.enable`            | `boolean` | `true`  | Find all references           |
| `gluals.references.fuzzySearch`       | `references.fuzzySearch`       | `boolean` | `true`  | Fuzzy search for references   |
| `gluals.references.shortStringSearch` | `references.shortStringSearch` | `boolean` | `false` | Search strings for references |

***

## Full example

```json .gluarc.json theme={null}
{
  "runtime": {
    "nonstandardSymbol": ["//", "/***/", "continue", "!=", "||", "&&", "!"],
    "requireLikeFunction": ["include"],
    "special": {
      "include": "require"
    }
  },
  "strict": {
    "allowNullableAsNonNullable": true,
    "inferredTypeMismatch": false
  },
  "doc": {
    "privateName": ["m_*", "_*"]
  }
}
```
