Skip to content

Ketho/vscode-wow-api

Repository files navigation

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.

Activation

Important

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.

Features

API

  • Enum and Constants table
  • LE_ Lua Enums

Shows completion for GlobalStrings at >3 uppercase letters to declutter fuzzy search.

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.

  • file1.lua
---@class ns
local ns = select(2, ...)

ns.foo = "hello"
  • file2.lua
---@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

Acknowledgements