Skip to content

TOC File Support

wowlua-ls provides full language server features for WoW .toc files: syntax highlighting, hover documentation, completions, go-to-definition, and diagnostics.

What it does

Every WoW addon has a .toc file that declares metadata (title, dependencies, saved variables) and lists the Lua/XML files to load. Editing these files without tooling means memorizing field names, manually checking file paths, and catching typos only at runtime.

With TOC support enabled, you get:

  • Syntax highlighting: Header keys, values, comments, directives, and file paths are colorized
  • Hover documentation: Hover any standard field name to see what it does, or hover an Interface version to see which expansion it maps to
  • Completions: Type ## and get suggestions for all standard fields; type a value and get context-aware options (game types, boolean values, file paths)
  • Go-to-definition: Click a file path to jump directly to that .lua or .xml file
  • Diagnostics: Catch common mistakes before you reload your addon

Example

## Interface: 110100
## Title: My Addon
## Notes: Does useful things
## SavedVariables: MyAddonDB
## Dependencies: Ace3
## AllowLoadGameType: mainline, cata
## IconTexture: Interface\Icons\INV_Misc_QuestionMark
## LoadOnDemand: 1

# Core files
Core/Init.lua
Core/Config.lua

# UI
UI/MainFrame.xml
UI/MainFrame.lua

Hovering Interface shows its documentation. Hovering 110100 shows "The War Within 11.1.x". Hovering mainline shows "Retail (The War Within, etc.)".

Completions after ## suggest Title, Notes, Author, SavedVariables, etc., filtered to exclude fields you've already declared.

Supported fields

wowlua-ls recognizes all standard TOC fields:

FieldDescription
InterfaceWoW client interface version (required)
TitleAddon display name in the addon list
NotesShort description tooltip
AuthorAddon author(s)
VersionVersion string
SavedVariablesAccount-wide persisted globals
SavedVariablesPerCharacterPer-character persisted globals
DependenciesRequired addon dependencies (alias: RequiredDeps)
OptionalDepsOptional load-order dependencies
LoadOnDemandLoad only when explicitly requested (1/0)
DefaultStateWhether enabled by default (enabled/disabled)
LoadWithLoad this addon when any listed addon loads
LoadManagersAddons that manage loading this addon
IconTextureAddon compartment icon
AddonCompartmentFuncCompartment click handler
AddonCompartmentFuncOnEnterCompartment hover-enter handler
AddonCompartmentFuncOnLeaveCompartment hover-leave handler
AllowLoadGameTypeRestrict to specific game flavors: mainline, classic, vanilla, cata, wrath, tbc, mists
OnlyBetaAndPTRRestrict to test realms only
SecureBlizzard-signed secure code marker

Additionally:

  • X-* fields: Custom addon metadata (e.g. X-Website, X-Curse-Project-ID) are recognized and won't trigger unknown-field warnings
  • Locale suffixes: Fields like Title-deDE, Notes-enUS, Category-enUS are recognized as localized variants

Per-line directives

TOC files support two kinds of bracketed tokens on file lines: load conditions that restrict when a file loads, and path variables that expand inline within the path. Conditions may appear before, after, or between path segments - the WoW client's documented form places them after the path:

Retail/FrameOverrides.lua [AllowLoadGameType mainline]
Classic/Compatibility.lua [AllowLoadGameType classic]
Localized.lua [AllowLoadGameType mainline] [AllowLoadTextLocale enUS]
[Family]Shared/Utils.lua
Locale/[TextLocale].lua

The prefix form ([AllowLoadGameType mainline] File.lua) is also accepted.

BracketKindDescription
[AllowLoadGameType ...]ConditionOnly load this file on specified game flavors (mainline, standard, classic, vanilla, cata, wrath, tbc, mists, plunderstorm, wowhack)
[AllowLoadTextLocale ...]ConditionOnly load on specified client locales (e.g. enUS, frFR)
[AllowLoad ...]ConditionRestrict to an environment (ingame / glue)
[Family]Path variableExpands to the game family subdirectory (Mainline / Classic)
[Game]Path variableExpands to the specific game subdirectory
[TextLocale]Path variableExpands to the client text locale (e.g. enUS)

Only [AllowLoadGameType] affects flavor filtering; the other conditions are recognized and stripped but don't change a file's flavor. Hover a bracket to see its documentation.

Diagnostics

TOC files have their own set of diagnostics:

CodeSeverityDescription
toc-missing-interfaceWarningRequired ## Interface: field is missing
toc-duplicate-headerWarningSame header key appears more than once
toc-unknown-headerHintHeader not in the known catalog and not an X-* custom field
toc-invalid-interfaceErrorInterface value is not a valid numeric version
toc-nonexistent-fileWarningReferenced file does not exist on disk
toc-invalid-valueWarningValue doesn't match the expected format for its field

Go-to-definition

Click any file path in a TOC file to navigate directly to that file. This works for both .lua and .xml references. Paths are resolved relative to the TOC file's directory.

Files referenced through [Family] or [Game] path variables cannot be resolved (they depend on the client's install configuration).

No configuration needed

TOC support is enabled automatically when you open a .toc file. No .wowluarc.json settings are required. The language server activates on .toc files the same way it does for .lua files.