-
-
Notifications
You must be signed in to change notification settings - Fork 35
Home
Ketho edited this page Aug 27, 2024
·
16 revisions
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"
The class name (e.g. ns
) does not need to be unique unless there are multiple addons in your workspace.
If you intend to use deprecated APIs for Classic, the warning and strikethrough can be removed by disabling its diagnostic.
There is currently no targeted support for Classic Era and Cataclysm Classic. But the hover tooltip will show the flavors a function exists in.
To avoid loading for Lua projects not related to World of Warcraft, there are a couple of measures in place.
This extension will only activate when either:
- the extension was previously loaded in the workspace.
- a
settings.json
withLua.workspace.library
containing a path with the substringwow-api
exists in the workspace on startup.
- a
- a .toc file exists.
- a
.toc
file with the## Interface:
directive exists in the workspace on startup.
- a
- the "Activate WoW API extension" command is used.