-
-
Notifications
You must be signed in to change notification settings - Fork 320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EmmyLua: Annotate shared tables (WoW addon namespace) #1158
Comments
@Ketho when I have encountered this scenario, I've found that re-declaring the class while inheriting from itself often achieves the correct behavior:
|
That looks like a usable workaround at least, with disabling the "circularly inherited classes" warning, thanks. I do hope there will be a proper fix or maybe any better solution. |
I'm trying to do a specific thing for which definitions and annotations were recognized between different files in the past. I describe it in #Ketho/vscode-wow-api#31 TLDR: I use a global table containing subtables with tools I use between different WoW addons (they all see global variables). The tools are in subtables to account for the addons getting updates separately which may include changes to this shared toolset. Overengineered? Probably. Anyhow, the problem is that I can't figure out how and where to put class definitions as workarounds in this case to be able to pull annotations through for the functions in the toolset subtable inside that global table at the specific version key which I store in the addon's namespace table. What I have is a subclass - the subtable of the global table which has a variable name: the current version of the toolbox the specific addon uses. I don't know how to describe that in EmmyLua to be able to set recognizable field definitions for the tool functions inside. *@sumneko I was able to test past versions and everything was working in version 2.6.8 until 3.0.2 (and presumably 3.0.0 and 3.0.1 but I wasn't able to get these to versions loaded after rollback in VS Code). Something was changed, introduced or got broken with the 3.0 update. Temporary workaround: Roll back to version 2.6.8 |
Thank you, that works perfectly! I didn't think it could be this simple by just using |
@sumneko Hi! After mentioning it here: #980 (comment), I still can't make it work with my use case (described in the comment linked below). I'd like to ask for some assistance to either understand what I'm supposed to add or find a fix to restore the functionality observed in the extension version 2.6.8 as seen in the demonstration in the linked comment. I was using 2.6.8 up til now but I tried updating to see if anything changed since then. |
I think this has nothing to do with the theme of this Issue. You should open a new Issue and provide a demo code. |
Describe the bug
In World of Warcraft addons have multiple Lua files which share a table (the addon namespace). Since the language server doesn't know about that so we need to manually annotate it.
But the language server implementation does not support editing classes. You can only define it once with
---@class ns
and all the other files with---@type ns
can only read from it.To Reproduce
Expected behavior
To work the same way as the IntelliJ EmmyLua plugin.
Environment:
Referring from Ketho/vscode-wow-api#31
The text was updated successfully, but these errors were encountered: