Adds IntelliSense features for World of Warcraft API to VS Code. This is a plugin extension for Sumneko's Lua Language Server with annotations.
- Includes the WoW Lua 5.1 environment
- Loads the official Blizzard API documentation
- Parses Warcraft Wiki API documentation
Enum
andConstants
tableLE_
Lua Enums
Shows completion for GlobalStrings at >3 uppercase letters to declutter fuzzy search.
To avoid loading for Lua projects not related to World of Warcraft, all settings will be specific to the workspace instead of the global user settings; and this extension will only activate when either:
- the extension was previously loaded in the workspace.
- details: a
settings.json
withLua.workspace.library
containing a path with the substringwow-api
exists in the workspace.
- details: a
- a .toc file exists.
- details: a
.toc
file with the## Interface:
directive exists in the workspace.
- details: a
- the
Activate WoW API extension
command is used.
LuaLS doesn't know about the AddOn namespace, so this needs to be annotated with @class in each file. This way the language server knows about the shared table and also allows you to mutate it, which would not be possible with a single @class
and then @type
in other files.
file1.lua
---@class ns
local ns = select(2, ...)
ns.foo = "hello"
file2.lua
---@class ns
local ns = select(2, ...)
ns.bar = "world"
The extension reflects the state of the wiki, so if you create/update the wiki pages, it will be updated in the extension on the next release. Otherwise feel free to create an issue with the false errors.
For example UnitLevel would be documented like so.
{{wowapi}}
Returns the level of the unit.
level = UnitLevel(unit)
==Arguments==
:;unit:{{apitype|string}} : [[UnitId]]
==Returns==
:;level:{{apitype|number}}
Alternatively, the script will look for a commented block for API pages not documented in Blizzard_APIDocumentationGenerated.
<!-- luals
---@param unit UnitId
---@return number level
function UnitLevel(unit) end
-->
Refer to SETUP.md if you want to run the Lua scripts which generate the documentation.
- Blizzard Entertainment
- Townlong Yak, Wago Tools, WoW.tools
- WoWInterface, Warcraft Wiki, Wowprogramming
People who have contributed to the WoW API documentation or the VS Code extension, or have written tools to make this possible.