WoW API for VS Code
Adds IntelliSense features for World of Warcraft API to VS Code. This is a third party extension for LuaLS with annotations.
Features
API
Enum
and Constants
table
LE_
Lua Enums
Shows completion for GlobalStrings at >3 uppercase letters to declutter fuzzy search.
Activation
This extension will only activate when either:
- A proper .toc file exists when the workspace is opened.
- The extension was previously loaded in the workspace.
- The "Activate WoW API extension" command is used.
Note that if the Configuration Scope
setting is set to User
instead of Workspace
and the extension has loaded once, then it will simply always load for Lua files, just like the old behavior.
AddOn namespace
The AddOn namespace 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.
---@class ns
local ns = select(2, ...)
ns.foo = "hello"
---@class ns
local ns = select(2, ...)
ns.bar = "world"
Deprecated API
If you intend to use deprecated APIs for Classic, the warning and strikethrough can be removed by disabling its diagnostic.
Documentation
More documentation is available on the project wiki.
Contributing
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}} : [[UnitToken]]
==Returns==
:;level:{{apitype|number}}
Alternatively, the script will look for a commented block for API pages not documented in Blizzard_APIDocumentationGenerated.
<!-- luals
---@param unit UnitToken
---@return number level
function UnitLevel(unit) end
-->
Developing
- Linux: Refer to SETUP.md if you want to run the Lua scripts which generate the documentation.
- Windows: I personally use LuaRocks on Windows but I like to shoot myself in the foot too. I should change this to use GitHub Actions or dev containers I suppose.
Acknowledgements
- Blizzard Entertainment
- Townlong Yak - Foxlit
- Wago Tools - QartemisT
- Warcraft Wiki - Kaydeethree
- WoWInterface
- Wowprogramming - jnwhiteh
- WoW.tools - Marlamin
- Annotations: Kozoaku, Numy, Oppzippy, Snakybo, Torhal, Wutname
- FrameXML: funkydude, Gethe, Tekkub
- LuaLS: Sumneko, carsakiller
- VS Code extension: ChrisKader, DakJaniels, thatnerdjosh, Yuyuli
- Wiki: DahkCeles, Foxlit, Iriel, Xelnath
- Algalon: Ghost
- Amazing people: Andols, Cidan, Ferronn, Meorawr, Nevcairiel
- BlizzardInterfaceResources: Resike
- DeadlyBossMods: Tandanu, MysticalOS
- IntelliJ-IDEA-Lua-IDE-WoW-API: Ellypse
- WeakAuras: Buds, Stanzilla