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

# @source

> Link generated annotations to source files or external documentation.

## Overview

`@source` links generated annotations back to their original source.

For local source URIs such as `file:///...`, GLuaLS uses `@source` as a **Go to Definition** redirect. For web URLs such as `https://...`, GLuaLS treats the URL as external documentation. Hover can show it as a clickable **Source** link without replacing the real code definition target.

When hover shows a symbol with `@source`, GLuaLS renders the source URI as a clickable Markdown link.

Use this in generated annotation files that point back to a real source file or an external reference page.

***

## Syntax

```lua theme={null}
---@source file:///absolute/path/to/file.lua#41:0
---@source https://wiki.facepunch.com/gmod/Entity:SetPos
```

`@source` accepts either a bare URI or a URI followed by `#line:column`.

* `file:///...` for local files used by **Go to Definition**
* `https://...` for web links shown from hover, not used as definition locations
* A bare local URI opens the target at `0:0`
* `line` and `column` use zero-based positions when present
* `#l41:0` is also accepted for the line part

***

## Usage

Use this in generated stubs when you want **Go to Definition** to jump from a stub to the real implementation.

```lua theme={null}
-- In some generated definition file:

---@class Player
local Player = {}

---@source file:///garrysmod/lua/includes/extensions/player.lua#41:0
function Player:SetHealth(hp) end
```

When you use **Go to Definition** on `Player:SetHealth()`, GLuaLS opens the `@source` target instead of the stub.

For generated wiki annotations, you can also point directly at a page:

```lua theme={null}
---@source https://wiki.facepunch.com/gmod/Entity:SetPos
function Entity:SetPos(pos) end
```

Hover shows that URI as a clickable **Source** link. **Go to Definition** still resolves to the annotation/code definition instead of opening the web page.
